How to use the onclick attribute in C# Webbrowser?

Asked

Viewed 29 times

3

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

I need to handle the onclick attribute, but returns nothing.

  • Can you explain further what you intend to do? The question is not clear to me

  • 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 the onclick. I can for example use the class, but the site has several buttons with the same class, if I do the class the click will be on all the elements that use the class, and there are many, then 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 in onclik does not return anything, I would like to know how to access this onclick attribute.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.