0

enter image description here


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?
3
  • What have you tried so far? Show us your code and point to the places where it does not work.
    – pavelsaman
    Aug 25 at 12:35
  • Please add this to the original question. Format the code. What error are you getting?
    – pavelsaman
    Aug 25 at 13:00
  • @pavelsaman I formatted the code, but couldn't find any error when I run my script and it failed to select the dropdown
    – QA stacker
    Aug 25 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.