0
<div class="countdownHolder"> <span class="countMinutes"> <span class="position"> <span class="digit static" style="top: 0px; opacity: 1; transition: 350ms ease;">0</span> </span> <span class="position"> <span class="digit static" style="top: 0px; opacity: 1; transition: 350ms ease;">0</span> </span> </span> <span class="countDiv countDiv0">:</span> <span class="countSeconds"> <span class="position"> <span class="digit static" style="top: 0px; opacity: 1; transition: 350ms ease;">4</span> </span> <span class="position"> <span class="digit static" style="top: 0px; opacity: 1; transition: 350ms ease;">0</span> </span> </span> </div>
我試着去閱讀的價值在閱讀HTML類此圖像中強調的,不太清楚如何從我在哪裏得到它。
功能
private HtmlElement[] GetElementsByClassName(WebBrowser wb, string tagName, string className)
{
var l = new System.Collections.Generic.List<HtmlElement>();
if (wb != null && wb.Document != null)
{
var els = wb.Document.GetElementsByTagName(tagName);
foreach (HtmlElement el in els)
{
if (el.GetAttribute("className") == className)
{
l.Add(el);
}
}
}
return l.ToArray();
}
IM如何調用它,它似乎找到countdownHolder類
var countdownHolder = GetElementsByClassName(_webBrowser, "div", "countdownHolder");
if (countdownHolder.Length != 0)
{
}
我不能100%確定使用什麼函數來讀取HTML – ramafe
上的每個部分我可以看到我想要在GetElementsByClassName中使用的所有類我的問題是我不知道如何走下所有的類從那裏找到我的價值,因爲你可以看到GetElementsByClassName HtmlDocument不知道如何從每個元素傳遞 – ramafe
真正的Html是一個網站,其巨大的 – ramafe