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

Answer Posted / rupesh

WebElement sel = myD.findElement(By.name("dropdown_name"));
List<WebElement> lists = sel.findElements(By.tagName("option"));
for(WebElement element: lists)
{
String var2 = tdElement.getText();
System.out.println(var2);
}

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to change the url on a webpage using selenium web driver?

556


What are the different components of the selenium?

561


What are the challenges with selenium ide?

634


When to use autoit?

648


How can we create an object repository in selenium?

570






What is the alternate way to click on login button?

1190


What is the difference between “/” and “XPath //”?

651


How to handle the AJAX popup window?

648


List some of the common automation frameworks.

554


Describe a framework. List some of the common automation frameworks.

600


How can we create object repository in selenium?

579


When should one use selenium grid?

606


Describe the purpose of xpath.

580


Explain how you can insert a break point in selenium ide?

574


What is intellij?

568