Jump to content

is it possible to send click on random links on a website?


Go to solution Solved by bootybay,

Recommended Posts

I have a website which has 10 links.

I want AutoIT to click on them randomly

for example, Link1, link2, link3 ...

it will click on link4, then sleep, then click on link 1

what I did :-

_IELinkClickByText($oIE, "link1")
sleep(1000)
_IELinkClickByText($oIE, "link2")

So, I dont want to write for link 3 or link 4 and so on continuously.

is it possible to do so?

Link to comment
Share on other sites

  • Solution

Do you want to cycle through those links or really randomize it?

For $i = 1 To 8 Step 1
    _IELinkClickByText($oIE, "link" & $i)
    Sleep(1000)
Next

The one above will click link1 - link8

For $i = 1 To 8 Step 1
    _IELinkClickByText($oIE, "link" & Random(1, 8, 1))
    Sleep(100)
Next

This one will click a random link between the numbers 1 and 8. And that 8x in a row.

Link to comment
Share on other sites

Do you want to cycle through those links or really randomize it?

For $i = 1 To 8 Step 1

    _IELinkClickByText($oIE, "link" & $i)

    Sleep(1000)

Next

The one above will click link1 - link8

For $i = 1 To 8 Step 1

    _IELinkClickByText($oIE, "link" & Random(1, 8, 1))

    Sleep(100)

Next

This one will click a random link between the numbers 1 and 8. And that 8x in a row.

 

Hi...thanks a lot for your reply. I think I missed one part... I want to cycle through those links ... :) randomilze not so necessary for me

After clicking on Link1, script must go back to previous page, then it will send click on link2

Local $oIE = _IECreate("www.google.com")
_IENavigate($oIE, "http://mypage.us/demo")
For $i = 1 To 2 Step 1
    _IELinkClickByText($oIE, "link" & $i)
    Sleep(10000)
Next
_IEQuit($oIE)
http://mypage.us/demo => this page has all the links.

So, in this script, its opening google, going to my site, clicking on Link1

but not going back to my site to click on Link2 and IE gets closed :(

Sorry I missed the part :( so ...need your help :(

 

Ok...so far I did this:-

Local $oIE = _IECreate("www.google.com")
_IENavigate($oIE, "http://mypage.ys/demo")
For $i = 1 To 10 Step 1
    _IELinkClickByText($oIE, "link" & Random(1, 10, 1))
    Sleep(10000)
    Next
_IENavigate($oIE, "http://mypage.ys/demo")
For $i = 1 To 2 Step 1
    _IELinkClickByText($oIE, "link" & Random(1, 10, 1))
    Sleep(10000)
 Next
Sleep(10000)

How do I keep it looping? :(

 

Ok... I fixed this

 

for random

#include <IE.au3>
Local $oIE = _IECreate("www.google.com")
For $i = 1 To 25 Step 1
_IENavigate($oIE, "http://mywebsite.us")
    _IELinkClickByText($oIE, "link" & Random(1, 25, 1))
    Sleep(10000)
    Next

for 1 by 1

#include <IE.au3>
Local $oIE = _IECreate("www.google.com")
For $i = 1 To 25 Step 1
_IENavigate($oIE, "http://mywebsite.us")
    _IELinkClickByText($oIE, "link" & $i)
    Sleep(10000)
    Next

Thanks you for your help :)

Edited by debkol35
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...