Wednesday, May 6, 2015

Select an item from dropdown in Selenium

Selenium provides 3 methods:

  1. selectByIndex
  2. selectByVisibleText
  3. selectByValue
eDropdown = driver.findElement(By.xpath(""));
Select select = new Select(eDropdown);
select.selectByIndex(2);
select.selectByVisibleText("Ottawa")
select.selectByValue("ON");

No comments:

Post a Comment

Selenium 3 vs Selenium 4