clickon a image in a webpage

cpampas

Registered User.
Local time
Today, 00:05
Joined
Jul 23, 2012
Messages
221
hi,

In myForm I have a webbrowser control that loads a webpage, with a main image


the full page is loaded into the webbrowser control, but I would like to get the image slide show, obtained by clicking the main image, instead of the hole page.

I have tried, with no sucess :
Dim ieFotos As WebBrowser
Set ieFotos = Me.WebBrowser2.Object
Me.WebBrowser2.Object.Silent = True

Dim strPath As String
strPath ="path to webpage"

ieFotos.Navigate strPath
' I have a timer here that pauses until page is loaded
For Each ctlSelect In ieFotos.Document.getElementsByTagName("select")

If ctlSelect.Name = "MainImg" Then
ctlSelect.Click
Exit For
End If
Next

Any thoughts ?
thanks
 
it worked like like this, after the page has been loaded to the webbrowser control :

Dim doc As HTMLDocument
Dim oElement As Object
Set doc = wb.Document
Set oElement = doc.getElementsByClassName("MainImg")
oElement(0).Click
 

Users who are viewing this thread

Back
Top Bottom