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 can we find all the links on a web page?
How to handle alerts in selenium?
Explain how to iterate through options in test script?
How to print Duplicate values in Drop Down List
What are the different components of the selenium?
How to change the url on a webpage using selenium web driver?
What selenese command and argument can be used to transfer the value of a javascript variable into a side variable?
What do you know about Selenese?
How many types of waits in selenium?
Explain what does @test(invocationcount=?) And @test(threadpoolsize=?) Indicate.
How can we check if an element is getting displayed on a web page?
what is your approach clicking all the links which are available on the page?
What are the regular expression patterns available in selenium?
How to get the number of frames on a page?
How do you send enter/tab keys in webdriver?