0

是否有类似 SHDocvw.dll 的移动等效项用于在 Xamarin 中公开 HTML 文档对象模型?是的,我知道你不能在安卓设备上使用 Internet Explorer,这就是我说“喜欢”的原因。

我已经尝试过 HTMLAgilityPack 并且没有任何成功。Windows 窗体中的原始 C# 代码如下所示,效果很好(显然,这不是完整的代码......)。Xamarin 中的 WebView 对象似乎无法用于网络抓取。

我不想使用 xaml 并希望将所有内容都保存在代码中。另外,如果有办法只在内存中使用浏览器,那是我的最佳解决方案。我不想显示浏览器。

        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) &&
                        (
4

0 回答 0