Jump to content
UBot Underground

Loop Through Items In A Web Dropdown List


Recommended Posts

Hi

 

I'm trying to create a bot that will loop through a dropdown list and perform actions on each selection. 

My problem is the iteration of the dropdown.

 

Can any of you advise on how to do a simple loop through a dropdown list from a website?

 

Thanks in advance!

Link to post
Share on other sites

Depends a bit on the website. But in general it should be possible to scrape the drop down menu entries from the html code. 
So you basically would do:

 

add list to list  (with scrape attribute extracting the dropdown elements)
then loop through the list and perform the action. 

Use change dropdown to select the correct dropdown menu setting. 

But it all starts with putting the dropdown menu options into a list. 
 

Dan

  • Like 2
Link to post
Share on other sites

Here is a visual representation of what Dan said
 

Edit: misread it at first, now it is corrected.

navigate("http://ubotsandbox.com/drop-down-boxes.php", "Wait")
wait(3)
clear list(%cities)
comment("We get the child elements of the dropdown named \"cities\"
the child elements are the <option> and the value is what
we are targeting")
add list to list(%cities, $scrape attribute(<tagname="option">, "value"), "Delete", "Global")
loop($list total(%cities)) {
    alert("Changing city")
    change attribute(<name="cities">, "value", $next list item(%cities))
    wait(1)
    comment("Do whatever you want here")
}

  • Like 2
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...