Resolving “Element is Not Clickable at Point” Error in Selenium

Resolving "Element is Not Clickable at Point" Error in Selenium

26 February 2025 Stephan Petzl Leave a comment Katalon Issues

Encountering the “Element … is not clickable at point (x, y)” error in Selenium can be a common hurdle during automated test execution. This issue typically arises when the intended element is obscured by another element or is not within the visible viewport. Below, we outline practical solutions to address this problem effectively.

Common Causes and Solutions

JavaScript or AJAX Interference

JavaScript or AJAX calls may prevent an element from being clicked. To circumvent this, you can utilize the Actions class:


WebElement element = driver.findElement(By.id("id1"));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().build().perform();
  

Element Not in Viewport

If the element is not visible within the current viewport, use JavascriptExecutor to bring it into view:


JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("arguments[0].scrollIntoView();", element);
  

Page Refresh or Overlays

In cases where the page refreshes or overlays obscure the element, implementing Explicit Wait can ensure the element is ready for interaction:


WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.id("id1")));
  

Handling Permanent Overlays

For permanent overlays, use JavascriptExecutor to directly click the element:


WebElement ele = driver.findElement(By.xpath("element_xpath"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", ele);
  

Alternative Solutions

If the above methods do not resolve the issue, consider defining a custom ExpectedCondition that attempts to click the element until successful:


public class SuccessfulClick implements ExpectedCondition {
    private WebElement element;
    public SuccessfulClick(WebElement element) { this.element = element; }
    @Override
    public Boolean apply(WebDriver driver) {
        try {
            element.click();
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
  

Leveraging Repeato for Automated Testing

For those seeking a streamlined approach to automated testing, Repeato offers a robust no-code solution that eliminates many common challenges associated with tools like Katalon.

  • Repeato’s AI-driven test automation supports complex interactions using computer vision.
  • It allows running command-line scripts or JavaScript code, making it versatile for various testing needs.
  • Data-driven testing and keyword-driven testing are seamlessly integrated, enhancing test coverage.
  • With all data saved in text and JSON format, version control is straightforward, ensuring efficient team collaboration.

In contrast to Katalon, Repeato eliminates the dependency on a single scripting language and offers a more open and flexible testing environment. To explore more about how Repeato can transform your testing processes, visit our documentation page.

Like this article? there’s more where that came from!