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
How to get the title of the page?
Explain what does @test(invocationcount=?) And @test(threadpoolsize=?) Indicate.
What does side stand for?
What are the important features of selenium ide?
What is testng assert and list out some common assertions supported by testng?
What are the challenges and limitations of selenium webdriver?
What api is required for database testing in selenium webdriver?
What is webdriver wait in selenium webdriver?
Write a code snippet to navigate back and forward in browser history?
What could be the cause of the selenium webdriver test to fail?
How to scroll down a page using javascript in selenium?
List the different types of locaters in selenium.
What is the selenium's recording language?
What is pom (page object model)?
What is the purpose of creating a reference variable- 'driver' of type webdriver instead of directly creating a firefoxdriver object or any other driver's reference in the statement webdriver driver = new firefoxdriver();?