Hello All:
I’m using Webdriver 3.6.0 with Chrome 62.0
On a win7 64bit box
I’m trying to select a value from a dropdown list box but am having problems selecting based upon the values in the list box. I have included the element and the code below.
<ul id="customerdetailform:customerdetailtabs:cdedulevel_items" class="ui-selectonemenu-items ui-selectonemenu-list ui-widget-content ui-widget ui-corner-all ui-helper-reset" role="listbox" aria-activedescendant="customerdetailform:customerdetailtabs:cdedulevel_0">
<li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all ui-state-highlight" data-label="&nbsp;" tabindex="-1" role="option" id="customerdetailform:customerdetailtabs:cdedulevel_0"> </li><li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all" data-label="No Grade" tabindex="-1" role="option" id="customerdetailform:customerdetailtabs:cdedulevel_1">No Grade</li>
<li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all" data-label="1 Grade" tabindex="-1" role="option" id="customerdetailform:customerdetailtabs:cdedulevel_2">1 Grade</li>
li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all" data-label="2 Grade" tabindex="-1" role="option" id="customerdetailform:customerdetailtabs:cdedulevel_3">2 Grade</li>
<li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all" data-label="Doctorate Degree" tabindex="-1" role="option" id="customerdetailform:customerdetailtabs:cdedulevel_28">Doctorate Degree</li></ul>
driver.findElement(By.id("customerdetailform:customerdetailtabs:cdedulevel")).click();
WebDriverWait wait = new WebDriverWait(driver, 100);
By selectElementSelector = By.id("customerdetailform:customerdetailtabs:cdedulevel_input");
WebElement selectElement =
wait.until(ExpectedConditions.presenceOfElementLocated(selectElementSelector));
Select dropdown = new Select (selectElement);
dropdown.selectByVisibleText("2 Grade");
I can select the value if I use the following but I need to be able to select based upon the text
driver.findElement(By.id("customerdetailform:customerdetailtabs:cdedulevel")).click();
driver.findElement(By.id("customerdetailform:customerdetailtabs:cdedulevel_3")).click();
Any help will be appreciated.