WebBrowser: Programmaticaly click an image button

  • Thread starter Thread starter nime
  • Start date Start date
N

nime

I got an image button in a form. I want to simulate a click through programming.
There is no Click method for HTMLElement. I tried el.RaiseEvent("Click")
instead and an error occured.

How can I click the image button?

For Each el In frm.All
If el.TagName.ToString = "INPUT" Then
Debug.Print(el.OuterHtml)
If el.GetAttribute("type") = "image" Then
If el.GetAttribute("Value") = "Login" Then
el.RaiseEvent("Click")
Exit For
End If
End If
End If
Next el
 
Hello nime,

Well, you either click the button to submit the form.. in which case you
want to call Form.submit()... or you click the button to invoke a click handler
(<img onclick="someJSFunction()">).. in which case you call the function
direct.

-Boo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top