0

Help me with selenium commands/code to fetch the data from the list. We can only select the data from the list, since entering text(like auto search) is not allowed.

enter image description here

I have used the following code, but couldn't resolve the issue. Also I have doubt regarding which xpath given Do I need to give the xpath of the input field or the drop down list?

    *WebElement mySelectElement = driver.findElement(By.xpath("//*[@id='basicBootstrapForm']/div[7]/div/multi-select"));
    Select dropdown= new Select(mySelectElement);
        dropdown.selectByValue("Arabic");
        dropdown.selectByIndex(2);
        dropdown.selectByVisibleText("Catalan");*
James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

You need to first click on the dropdwon box and then find out the elemnet you are looking for and then click.Hope this help you.Let me know if this work

driver.findElement(By.id("msdd")).click();
        List<WebElement> languages=driver.findElements(By.xpath("//a[@class='ui-corner-all']"));
        for(int i=0;i<languages.size();i++)
          {
            System.out.println(languages.get(i).getText());
            if(languages.get(i).getText().equalsIgnoreCase("Arabic"))
            {
                languages.get(i).click();
                break;
            }
          }
KunduK
  • 32,888
  • 5
  • 17
  • 41