How to retrieve the value of options from a select drop-down using Selenium?

前端 未结 1 1745
无人共我
无人共我 2021-01-26 05:20

In the given code, I need the list of the value of the \"value\" attribute for each of the options in the select drop-down :

 tag you can use the following Java based solution:

Select dropDownSelect = new Select(driver.findElement(By.id("myselect")));
List dropDownActualValues = dropDownSelect.getOptions();
for(WebElement element:dropDownActualValues)
    System.out.println(element.getAttribute("value"));

0 讨论(0)
提交回复
热议问题