user3740292
user3740292

Reputation: 17

autoit script to click on random links on a website?

This is my script:

Local $oIE = _IECreate("www.google.com")
For $i = 1 To 25 Step 1
_IENavigate($oIE, "http://mysite.us")
    _IELinkClickByText($oIE, "link" & Random(1, 25, 1))
    Sleep(100)
    Next
_IEQuit($oIE)

What my script does is open mysite.us and click on random links 1 to 25. After clicking 25 links randomly, it closes IE. But I want it to click 1 to any number of links that I put in my site. Right now, only 25 links are there. In future, if I put more links and more links, it will continue to click those too.

I don't want to edit script each time I put links on my site. So,is there any way to do that?

Upvotes: 0

Views: 1130

Answers (1)

Milos
Milos

Reputation: 2946

Here you go.

Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
_IELinkClickByIndex($oIE, Random(0, $iNumLinks))

Upvotes: 2

Related Questions