![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjslnkg4ILigMnrxdc8InBO0sJ6ZHO3nnwn2AfM-VDRAAgXhkzWW21p1hwnoYbIWG29ma56o1L9jJYJhzVL5iukUqiaLF0bj_bPB6VRV_DcEogykHdMsVAz3yeXCaPtcWFl27jZ4PADGvU/s1600/20200818_203329.jpg)
We can select a Value from Drop down primarily in 3 ways, by using below methods.
- selectByValue
- selectByVisibleText
- sectByIndex
1) selectByValue:
Select drpDwn = new Select(driver.findElement(By.Id("dropdown-id")));
drpDwn.selectByValue("value");
2) selectByVisibleText:
Select drpDwn = new Select(driver.findElement(By.Id("dropdown-id")));
drpDwn.selectByVisibleText("Red");
3) selectByIndex:
Select drpDwn = new Select(driver.findElement(By.Id("dropdown-id")));
drpDwn.selectByIndex(3);
No comments:
Post a Comment