Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Find element in webbrowser based on src

$
0
0
Hey, so again i have one of my many webbrowser control questions. This time the question is, if i have a webpage source code that looks like such:
<img src="<img url>" width="62" height="20" alt="LIKE">


and i want to invoke the element based on the image url, how can i do this?
I tried:
For Each ele As HtmlElement In LikeBrowser.document.All
            If ele.GetAttribute("src") = "<image url>" Then
                ele.InvokeMember("click")
            End If
        Next


however, it never executes the "ele.InvokeMember("click")" statement (i tested that via putting a message box in there). I'd use the alt, but letter in the webpage there's an element with the same alt, so it invokes both & the other element causes a popup. I also tried using:
For Each ele As HtmlElement In LikeBrowser.document.All
            If ele.GetAttribute("alt") = "LIKE" and ele.GetAttribute("width") = "62" Then
                ele.InvokeMember("click")
            End If
        Next


but that gives the same result as using the src (it doesn't ever execute).

Can anyone help?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>