【发布时间】:2019-08-22 03:49:05
【问题描述】:
我有以下 Html 代码
<div class='blah'>...<div>
<div class='ct-bottom'>
<button A>A</Button>
<button B>B</Button>
</div>
我正在尝试使用 C# SHDocVw 来查找 div 元素并将子元素从中取出。这是C#代码
SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer();
IE.Navigate(Url_Home);
foreach (HTMLDivElementClass div in IE.Document.GetElementsByClassName("ct-bottom"))
{
if (div.innerHTML !=null )
{
Console.WriteLine(div.children.length); // This does not work !
break;
}
}
错误信息:
'object' 不包含'length' 的定义,并且找不到接受'object' 类型的第一个参数的扩展方法'length'
【问题讨论】: