dyvel 20 Posted December 15, 2014 Report Share Posted December 15, 2014 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! Quote Link to post Share on other sites
Bot-Factory 602 Posted December 15, 2014 Report Share Posted December 15, 2014 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 2 Quote Link to post Share on other sites
HelloInsomnia 1103 Posted December 16, 2014 Report Share Posted December 16, 2014 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") } 2 Quote Link to post Share on other sites
dyvel 20 Posted December 16, 2014 Author Report Share Posted December 16, 2014 Got it! Thank you both!Appreciate the helping hand :-) Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.