我想模拟点击到 c# webbrowser。但我没能成功。
要单击的此 Html 代码:
<a aria-label="2" class="rrl" href="javascript:ok();"><span class="ess ch"></span>2</a>
<a aria-label="3" class="rrl" href="javascript:ok();"><span class="ess ch"></span>3</a>
<a aria-label="4" class="rrl" href="javascript:ok();"><span class="ess ch"></span>4</a>
<a aria-label="5" class="rrl" href="javascript:ok();"><span class="ess ch"></span>5</a>
我不正确的 C# 点击代码:
foreach (HtmlElement el in webBrowser1.Document.GetElementsByTagName("a"))
{
if (el.GetAttribute("aria-label") == "4")
{
el.InvokeMember("Click");
}
}
我想按区域标签号点击