Best way to create a random href click?



  • having trouble getting this to work properly.
    I like idle emulation but i also want to add another layer on top and click a random link on page.

    1. i use xpath to identify hrefs on page and save all identified href string as a variable "all_urls" ( in my example i got 40 hrefs on that page)

    2. ==problem step=== i dont think i just click and element with a variable that has many strings.. so I tried to randomize the "all_urls" variable many different ways but this is the step im having problems with. I tried to create a random number from "all_urls" then tried to create another variable called? "random_url"

    3. I do click on element > AT > [[random_url]]

    But this never works. I think im screwing up step 2 some how and cant figure out what im doing wrong or the best way to randomize "all_urls" and create a seperate variable called "random_url"

    How can i select a random link from "all_urls" and then click?

    Is there a way to just use xpath to identify all hrefs on the page create variable then use that variable directly via the "click the element"?

    Thank you!



  • Maybe not the best way to do it but you can scrape all possible urls on the page and then add all to a new list then you can take a random line from the list and click it. That would 100% work.


Log in to reply