Problem accessing multi-select with Selenium webdriver and Java

Asked

Viewed 13 times

0

Multi-select

Hello everyone, I’m trying to access as shown in the image, a multi-select, which is in the yellow list, in ul and li, an option of Languages: Arabic, Bulgarian etc., and when selected, it goes to the box of the selected (green), passing to the list of div (indicated by the green line)

I tried those and nothing:

WebElement mySelectElement = driver.findElement(By.cssSelector("ul.ui-autocomplete"));
Select dropdown= new Select(mySelectElement);
dropdown.selectByIndex(2);

or

 WebElement select = driver.findElement(By.cssSelector("ul.ui-autocomplete li:nth-of-type(2)"));
 List<WebElement> options = select.findElements(By.tagName("li"));
    
       for (WebElement option1 : options) {

       if("Arabic".equals(option1.getText().trim()))
          
        option1.click();   

       }       
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.