我需要有一个标签,其文本来自网页,但是对于它不起作用,在我看来 webpae 返回 null,但位置是正确的。
WebBrowser JOJO = new WebBrowser();
string Tesla = "";
JOJO.Url = new Uri("https://finance.yahoo.com/quote/TSLA?p=TSLA");
var sal = JOJO.Document.GetElementsByTagName("div");// this return null
foreach (HtmlElement link in sal)
{
if (link.GetAttribute("className") == "D(ib) Mend(20px)")/*this is the class of the element*/
{
Tesla = link.FirstChild.InnerHtml;
}
}
label11.Text = Tesla;
这是我到目前为止所做的代码,有人可以看到为什么 dosnt 工作吗?
谢谢。