Unable to select ajax dropdown value with selenium webdriver

I am trying to select specific values ​​from 2 Ajax popup fields. The first list of drop-down lists opens, but does not select an option, so the second drop-down list is optional, and the error occurs as

org.openqa.selenium.NoSuchElementException: Cannot find the item: Option [value = "111"].

Please help me .. I'm new to selenium

Here is my code ..

Code

HTML block:

HTML block

+4
source share
2 answers

This issue occurred due to a Firefox browser compatibility issue (version 45). I am using selenium 3.0.0-beta2 and testing against Firefox 45.0.2

geckodriver ( 0.10.0) 10 -64 , , - . Firefox 48 .

+2

. - :

Select dropdown = new Select(driver.findElement(By.id("cmbJob")));
dropdown.selectByValue("111");

dropdwns:

protected void chooseOptionInSelectByValue(String selectId, String valueString) {
  Select dropdown = new Select(driver.findElement(By.id(selectId)));
  dropdown.selectByValue(valueString);
}

, ,

chooseOptionInSelectByValue("cmbJob","111");

Selenium , selectByText .. API : https://seleniumhq.imtqy.com/selenium/docs/api/java/org/openqa/selenium/support/ui/Select.html

0

Source: https://habr.com/ru/post/1652289/


All Articles