首页 > 解决方案 > Button Click without any ID C# Webbrowser

问题描述

How to click the button without any ID? I tried it with the web browser in C#. I tried the following code:

HtmlElementCollection elc = this.webBrowser1.Document.GetElementsByTagName("button");  
foreach (HtmlElement el in elc)  
{  
   if (el.GetAttribute("class").Equals("bb987"))
{  
el.InvokeMember("click");  
}  
}

This is the web code:

<span class="fr66n">
<button class="front"><span class="bb987" aria-label="Press">
</span></button></span>

Anybody who can help?

标签: c#button

解决方案


推荐阅读