How do you get all the values from Drop Down list?

Answer Posted / p sureshchowdary

Select dropdown=new Select(d.findElement(By.id("month")));
List<WebElement> list=dropdown.getOptions();
for(WebElement we:list) {
System.out.println(we.getText());
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between getwindowhandles() and getwindowhandle()?

570


Is selenium server needed to run selenium webdriver scripts?

550


How does one capture a page title in selenium 2.0?

588


What is the command to connect a node to the selenium grid?

610


Why should Selenium be selected as a testing tool?

604






Why selenium rc is used?

640


Please explain what are the different types of locators in selenium?

544


What are the different Exceptions in selenium?

576


What is the difference between driver.getwindowhandle() and driver.getwindowhandles() in selenium?

598


List some of the common automation frameworks.

554


Have you created any framework?

608


What is the difference between driver.findelement() and driver.findelements() commands?

545


What are the different types of web controller APIs supported in Selenium?

645


What is parameterization in testng?

588


How to press enter key on text box in selenium webdriver?

590