Selenium Element is not clickable at point with ExpectedConditions.elementToBeClickable



  • I have a problem with the following exception:

    org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (1128, 997). Other element would receive the click...

    My page object has a "buy now" button which I want to click.

    @FindBy(xpath = ".//*[@id='summary-right-column-wrapper']/div[3]/a")
    private WebElement buyNow;
    

    And I have a getter with a explicit wait build in:

    public WebElement getBuyNow() {
        return wait.until(ExpectedConditions.elementToBeClickable(buyNow));
    }
    

    When I call it:

    final WebElement readyBuyNow = getBuyNow();
    readyBuyNow.click();
    

    I get the exception.

    Why the element is still not clickable if I use the ExpectedConditionsalready?

    Thanks! Best regards Robert



  • The expected condition elementToBeClickable checks two things:

    • Visibility: it's not hidden per CSS rules (display: none)and has a height and width > 0
    • Clickable: the element may not have a disabled attribute

    It's perfectly possible that those conditions are met and you're still getting that specific exception.

    The most likely reason is some sort of pop-up, menu or autocomplete box appears over the element you're trying to click (which means nothing to Selenium in terms of 'visibility').

    Solution: make sure you close any elements hovering over the item you're trying to click. Without having your specific website to test on, that's the best answer I can give (and it has been the solution for me every time I had this issue).


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2