I have a web-element which on click produces a dropdown, I am able to click on web-element and see see all the elements using the code.
By mySelector = By.xpath("//li[contains(@class,'ant-select-dropdown-menu-item')]");
List<WebElement> myElements = driver.findElements(mySelector);
for (WebElement e : myElements) {
System.out.println(e.getAttribute("outerHTML"));
}
Also
driver.findElement(By.xpath("//li[text() = '"
+ user.getHomeLocation() + "']")).isDisplayed();
returns true
But I am not able to click the desired value.I want to click Westminster
<li unselectable="unselectable" class="ant-select-dropdown-menu-item-active ant-select-dropdown-menu-item" role="menuitem" aria-selected="false" style="-moz-user-select: none;">Select</li>
<li unselectable="unselectable" class="ant-select-dropdown-menu-item" role="menuitem" aria-selected="false" style="-moz-user-select: none;">Basking Ridge</li>
<li unselectable="unselectable" class="ant-select-dropdown-menu-item" role="menuitem" aria-selected="false" style="-moz-user-select: none;">Highlands Ranch</li>
<li unselectable="unselectable" class="ant-select-dropdown-menu-item" role="menuitem" aria-selected="false" style="-moz-user-select: none;">Westminster</li>