<img src="/images/skip/en.png" alt="Skip" height="39" id="skip">

I tried this code:

Dim theElementCollection As HtmlElementCollection = Bot.Document.GetElementsByTagName("img")
        For Each curElement As HtmlElement In theElementCollection
            Dim controlName As String = curElement.GetAttribute("name").ToString
            controlName = "skip"
            curElement.InvokeMember("click")

So pretty much I need to click the image to pass to the next page.

Is the next page static (the url is always the same)? If yes, then wrap the image in an anchor tag. Other use an imageButton.

No, once you click the image it will redirect to a new URL.

so say the image is on blah.com once the program clicks it then the url will change to google.com

This is part of the HTML too:

<a style="position: absolute; width: 300px; text-align: right; height: 30px; top: 10px; right: 20px; color: rgb(255, 255, 255); font-weight: bold; font-size: 16px; " id="skip_button" onclick="skipButton()" target="_top" href="http://google.com">

See if this helps.

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With WebBrowser1 '// FOR.TESTING
            Dim sT As String = "<a style=""position: absolute; width: 300px; text-align: right; height: 30px; top: 10px; right: 20px; color: rgb(255, 255, 255); font-weight: bold; font-size: 16px;"" id=""skip_button"" onclick=""skipButton()"" target=""_top"" href=""http://google.com""></a>"
            .DocumentText = sT
        End With
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        With WebBrowser1
            .Navigate(getUrl(.Document.Body.InnerHtml, "skip_button"))
        End With
    End Sub

#Region "----===----===----===-----   -----===----===----===----"
    Private iSi, iEi As Integer
    Private Function getUrl(ByVal selContent As String, ByVal selCoolHtmlID As String) As String
        With selContent
            If .Contains(selCoolHtmlID) Then '// check .innerHTML for ID.
                iSi = .IndexOf(selCoolHtmlID) '// locate.ID.
                iEi = .IndexOf(">", iSi) '// locate html.element end.
                If Not iSi <= 0 Then '// (beta) locate start of html.element.
                    Do Until selContent(iSi) = "<" : iSi -= 1 : Loop
                End If
            End If
            selContent = .Substring(iSi, iEi - iSi).Substring(.IndexOf("href") + 6) '// locate.URL.
        End With
        Return selContent.Substring(0, selContent.IndexOf(""""))
    End Function
#End Region
End Class

See if this helps.

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With WebBrowser1 '// FOR.TESTING
            Dim sT As String = "<a style=""position: absolute; width: 300px; text-align: right; height: 30px; top: 10px; right: 20px; color: rgb(255, 255, 255); font-weight: bold; font-size: 16px;"" id=""skip_button"" onclick=""skipButton()"" target=""_top"" href=""http://google.com""></a>"
            .DocumentText = sT
        End With
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        With WebBrowser1
            .Navigate(getUrl(.Document.Body.InnerHtml, "skip_button"))
        End With
    End Sub

#Region "----===----===----===-----   -----===----===----===----"
    Private iSi, iEi As Integer
    Private Function getUrl(ByVal selContent As String, ByVal selCoolHtmlID As String) As String
        With selContent
            If .Contains(selCoolHtmlID) Then '// check .innerHTML for ID.
                iSi = .IndexOf(selCoolHtmlID) '// locate.ID.
                iEi = .IndexOf(">", iSi) '// locate html.element end.
                If Not iSi <= 0 Then '// (beta) locate start of html.element.
                    Do Until selContent(iSi) = "<" : iSi -= 1 : Loop
                End If
            End If
            selContent = .Substring(iSi, iEi - iSi).Substring(.IndexOf("href") + 6) '// locate.URL.
        End With
        Return selContent.Substring(0, selContent.IndexOf(""""))
    End Function
#End Region
End Class

I am getting this as an error:

selContent = .Substring(iSi, iEi - iSi).Substring(.IndexOf("href") + 6) '// locate.URL.

[img]http://speedcap.net/img/4a56cf77f356ab25880b665c272ba2d4/b17e1b55.png[/img]

>>I am getting this
.better than nothing, right?:D
I was getting "http://google.com".

In any case, If the Function starting on line.17 isNot there, Then it might .error.

>>I am getting this
.better than nothing, right?:D
I was getting "http://google.com".

In any case, If the Function starting on line.17 isNot there, Then it might .error.

I still don't get it. :(

sorry.

>>sorry.
<<sorry.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.