因此,我在webbrowser中有一个表,其中包含来自.net IE的一些td和a,我可以从elTB元素中获取元素
HtmlElementCollection elTB = wb1.Document.GetElementsByTagName("TABLE");
HtmlElementCollection elc = elTB[2].GetElementsByTagName("TD");但是如果我尝试geckofx,它总是给我错误,有人能帮助我吗?(我是geckofx和c#的新手)
GeckoElementCollection tables = wb1.Document.GetElementsByTagName("TABLE");
GeckoElementCollection TD = tables[2].GetElementsByTagName("A");发布于 2014-04-07 16:12:20
这是可行的:
Gecko.Collections.IDomHtmlCollection<GeckoElement> foo = item.GetElementsByTagName("table");
GeckoHtmlElement bar = foo[0] as GeckoHtmlElement;
GeckoElementCollection TD = bar.GetElementsByTagName("a");大多数时候,我都在想,电脑是不是半个智障,还是只有我一个人。
发布于 2014-04-07 19:53:54
我已经找到了答案:P,是的,它和你的一样
GeckoElement elDIVa = wb1.Document.GetElementById("element id");
Gecko.Collections.IDomHtmlCollection<GeckoElement> elA = elDIVa.GetElementsByTagName("A");
foreach (GeckoElement el in elA)
{ etc etc }发布于 2016-04-21 15:04:10
您的问题来自大写,IE使用大写的HTML标签,GeckoFX使用小写,所以您应该将其更改为:
var tables = wb1.Document.GetElementsByTagName("table");
var TD = tables[2].GetElementsByTagName("a");我相信它能行得通。
https://stackoverflow.com/questions/22467489
复制相似问题