Tuesday, August 2, 2016

How to select value from drop down box

You  can select through 3 method:
1. SelectByVisibleText
2. selectByIndex
3. selectByValue

First identifie the drop down box
Select dropdown = new Select(driver.findElement(By.id("<>")));

To select its option say 'Programmer' you can do
dropdown.selectByVisibleText("Programmer ");

or
dropdown.selectByIndex(1);

or
 dropdown.selectByValue("prog");

No comments: