Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99018

How do I automate multiple options from dropdown simultaneously [closed]

$
0
0

How do I automate dropdown multiple times using a single piece of java code

For example: Dropdown has 10 webelement options and would like to perform actions on any 6 options like below -
Select item1, click submit Select item2, click submit Select item3, click submit

Here is what I have tried but doesn’t seem to work. List options = driver.findElementsByTagName("option");for (WebElement sample : options) { if (sample.getText().equals("UNITED STATE")) { sample.click(); } if (sample.getText().equals("ARUBA")) { sample.click(); } if (sample.getText().equals("ARUBA")) { sample.click(); } if (sample.getText().equals("BERMUDA")) { sample.click(); break; }}


Viewing all articles
Browse latest Browse all 99018

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>