Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
292 views
in Technique[技术] by (71.8m points)

how to handle the onclick attribute c# webbrowser?

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.

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...