0

Well I need to be able to click this picture out of my webbrowser in VB.

<img src="/images/skip_ad/en.png" alt="Skip Ad" height="39" id="skip_ad_button"

I have tried this code:

Dim col As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("img")
        For Each elem As HtmlElement In col
            If elem.GetAttribute("src").Contains("/images/skip_ad/en.png") Then
                elem.InvokeMember("click")
                ListBox1.Items.Add("clicked")
            End If

And this code:

Dim col As HtmlElementCollection = Bot.Document.GetElementsByTagName("img")
        For Each curElement As HtmlElement In col
            If curElement.GetAttribute("src").Equals("/images/skip_ad/en.png") Then
                curElement.Focus()
                curElement.InvokeMember("click")
            End If

Neither of them work. Is there another way to click the picture? If so could someone please explain?

Thanks a ton!

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by codeorder
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.