Link Clicker

Jixor

Registered Member
Joined
Jan 1, 2012
Messages
86
Reaction score
7
Hi

Ok so I'm not the most experienced in this field but I'm trying to create a program that visits a page, finds a link and then clicks on it. This is what I have so far:

Any help would be appreciated.

PS Cant use GetElementbyID as there is no visible ID in page source.

Code:
        If Web1.Visible Then
            For Each elem As HtmlElement In Web1.Document.GetElementsByTagName("a")
                If elem.InnerText = "embedded link in href tag" Then

                    'Invoke("click")?

                    Exit For
                End If
            Next



        End If
 
No one can help?
 
try this : elem.InvokeMember("click") It should works

or if not working :
elem.Focus()
elem.InvokeMember("click")
 
Ok I'll give this a try shortly. Thanks for your help.

EDIT

I got this working with some links but embedded objects seem to be a problem. Any idea how I could simulate a click on a embedded YouTube Video? I've tried using the above method but it doesn't seem to like it.

Any suggestions?
 
Last edited:
Try:
For Each elem As HtmlElement In Web1.Document.GetElementsByTagName("img")

System.IO.File.AppendAllText("img.txt",HtmlElement.src.tostring)

Next

or

For Each elem As HtmlElement In Web1.Document.GetElementsByTagName("div")
elem.Focus()
elem.InvokeMember("click")
Next
 
Try:
For Each elem As HtmlElement In Web1.Document.GetElementsByTagName("img")

System.IO.File.AppendAllText("img.txt",HtmlElement.src.tostring)

Next

or

For Each elem As HtmlElement In Web1.Document.GetElementsByTagName("div")
elem.Focus()
elem.InvokeMember("click")
Next

Thanks for the reply. However in your second solution it would basically click through all DIV tags on the page. For example the page I'm on is a twitter page.

Atthis point in time though I'm using a different method and now trying to get my webbrowser object to use an iphone useragent. However it does not like YT mobile one bit lol.
 
Last edited:
its prob not the answer you want, but if ive ever got a simple bot, ie just clicking a link, I just use Imacros, takes all of about 5 seconds to make lol
 
Back
Top