Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
159 views
by The go-to Tester (131 points)

1 Answer

1 like 0 dislike
by
Step 1: Find the Xpath for select dropdown and store it in webelement

WebElement selectbtn=driver.findElement(By.Id("select"));

Step 2: create an object for select class and pass the identified select drop down webelement as a parameter

Select ss=new Select(selectbtn);

Step 3: then using below 3 option we can select the drop down

ss.selectByindex(0); //index based value

ss.selectByvalue("1"); // value filed of the select options

ss.selectByvisibleText("Bangalore'); // visible text of the select drop down


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...