0
<ul class="list-group opened-list d-none" xpath="1">
    <li class="list-group-item col-12" xpath="1">My team</li>
    <li class="list-group-item col-12" xpath="1">My name</li>
    <li class="list-group-item col-12" xpath="1">My film</li>
    <li class="list-group-item col-12" xpath="1">My football teammate</li>
  </ul>

Dropdown list without select tag

1
  • 1
    I don't see an input element. What exactly are you trying to do? Commented Oct 21, 2019 at 16:51

1 Answer 1

1

To get all li elements use .list-group.opened-list .list-group-item css selector.
Code below wait visibility of li elements and then print text for each:

WebDriverWait wait = new WebDriverWait(driver, 10);
List<WebElement> options = wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector(".list-group.opened-list .list-group-item")));
options.forEach(element -> System.out.println(element.getText()));

If you want to select one of the element by text, check example here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.