how to handle the onclick attribute c# webbrowser?

╄→гoц情女王★ 提交于 2021-02-11 12:25:43

问题


HtmlElementCollection elementButton = webBrowser1.Document.GetElementsByTagName("a");
foreach (HtmlElement elementyButton in elementButton)
{
 if (elementyButton.GetAttribute("onclick") == "ExecuteBid('46097');")
 {
  elementyButton.InvokeMember("click");
 }
}

I intend to program an automatic click, but the click can only happen in a specific location, the only attribute different from the others is onclick. I can use the class, for example, but the site has several buttons with the same class, if I click through the class the click will be on all elements that use the class, and there are many, so the click will occur on all these elements, but I just want to click on a specific element and the only attribute that differentiates one element from the other is onclick, but giving getattribute on onclik does not return anything, I would like to know how to access this onclick attribute.

来源:https://stackoverflow.com/questions/65866424/how-to-handle-the-onclick-attribute-c-sharp-webbrowser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!