How to select a value from a drop-down?

Answer Posted / dileep kumar

by using select keyword we can select a value from dropdown box
select select = new select (driver.findelement(by.xpath(" xpath")));
select.selectbyindex(2);
select.selectbyvalue(2);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain dataproviders in testng ?

517


What is selenium-rc (remote control) ?

542


How can we deal with pop-up windows based on?

517


How can it be found if an item is displayed on the screen?

527


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

469






What do we mean by selenium 1 and selenium 2?

506


What is regular expressions? How you can use regular expressions in selenium?

512


How to type text in a textbox using selenium?

500


What are the types of waits available in selenium webdriver?

468


What if you have written your own element locator and how would you test it?

636


How to write selenium code for purchasing product from amazon

1179


Tell us how will you use selenium to upload a file?

478


What is the selenese command to show the value of a variable in the log file?

501


How to find whether an element is displayed on the web page?

483


Can you use Selenium to test the Rest API or Web services?

495