Home All Groups Group Topic Archive Search About

WebBrowser: Programmaticaly click an image button

Author
2 Jul 2006 10:55 PM
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

Author
3 Jul 2006 3:25 AM
GhostInAK
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

Show quoteHide quote
> 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