Below are the code which I used:
driver.findElement(By.xpath(“//div[@class=’ flag-dropdown’]”)).click();
WebDriverWait wait = new WebDriverWait(driver, 10);
List<WebElement> options = driver.findElements(By.xpath(“//ul[@role=’listbox’]/li”));
By Country1 = By.xpath(“//ul[@role=’listbox’]/li[85]”);
WebElement element1 = driver.findElement(Country1);
Thread.sleep(1000);
for (WebElement opt : options) {
if (opt.equals(element1)) {
WebElement element3 = null;
element3 = wait.until(ExpectedConditions.presenceOfElementLocated(Country1));
element3.click();
}
}
My error is:
Exception in thread “main” org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <li data-flag-key=”flag_no_83″ class=”country” data-dial-code=”1″ tabindex=”0″ data-country-code=”is” role=”option”>…</li> is not clickable at point (746, 276). Other element would receive the click: <input class=”search-box” type=”search” placeholder=”search” autocomplete=”off” value=””>
(Session info: chrome=92.0.4515.159)
and it scrolls to the required country but I’m unable to click it.
Can anyone help me with this?
Source: Read More