Hey there! any question in your mind? Ask It Now!.

Popular Categories





How to select a drop down in selenium web driver?

+1 vote
607 views
asked in Software Testing by krish Expert (6,310 points)

i have a web application ,their some dropdowns are their and want to automate them.

I am trying 

driver.findElement("By.id("ID")").click();

driver.findElement("By.id("ID")").sendKey("India");

But not working.

1 Answer

+2 votes
answered by seleniumGuru Expert (4,570 points)
selected by krish
 
Best answer

you should use select class like this :

      Select select = new Select(driver.findElement("By.id("ID")"));
       select.selectByValue("india");
Enjoy!
commented by krish Expert (6,310 points)
thanks it works :)

Related Questions

+2 votes
1 answer 1,404 views
+1 vote
1 answer 2,344 views
+5 votes
7 answers 14,865 views
+2 votes
1 answer 177 views
+2 votes
2 answers 888 views
+11 votes
1 answer 165 views

Not a Member yet?

Ask to Folks Login

My Account
454 Folks are online
4 members and 450 guest online
Your feedback is highly appreciated