Is there a mobile equivalent like SHDocvw.dll for exposing the HTML Document Object Model in Xamarin? Yes, I realize you can't use Internet Explorer on an android device, that's why I said 'like'.
I've already tried HTMLAgilityPack and have not had any success. The original C# code in windows forms is below and works great (obviously, this is not the complete code....). The WebView object in Xamarin appears to be very unusable for web scraping.
I do not want to use xaml and want to keep everything in code. Also, if there is a way to use a browser only in memory that is my optimal solution. I don't want to display a browser.
HtmlElementCollection divs = webBrowserSF.Document.GetElementsByTagName("div");
foreach (HtmlElement div in divs)
{
if (div.Name == "Collapsed")
{
blnCollapsed = true;
}
if ((div.Name == "cr_cashflow_strap") && (blnCollapsed == true))
{
div.InvokeMember("Click");
blnCollapsed = false;
}
}
HtmlDocument htmldoc = webBrowserSF.Document;
HtmlElementCollection trs = webBrowserSF.Document.GetElementsByTagName("tr");
intTR_Row = 0; // start with first value in tr collection
foreach (HtmlElement tr in trs)
{
HtmlElementCollection tds = tr.GetElementsByTagName("td"); //get all the td elements in that specific tr
intCell = 0; //'start with the first value in the td collection
blnSkipRow = false;
foreach (HtmlElement cl in tds)
{
// These are the default measures to display
if (
(intTR_Row > 1) &&
(cl.InnerText != null) &&
(intCell == 0) &&
(
Aucun commentaire:
Enregistrer un commentaire