I have the following Selenium test:
WebDriver driver = new ChromeDriver();
driver.get("https://qualysguard.myorg.com/fo/login.php?idm_key=saml2_78743hhh43");
// Wait for the element to be clickable
WebElement element = new WebDriverWait(driver, 20)
.until(ExpectedConditions.elementToBeClickable(By.linkText("Scans")));
// Try clicking the "Scans" tab
element.click();
When I run it, I get:
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element` <a ...>` is not clickable at point (180, 100). Other element would receive the click: `<div id="page-loading-mask" style="visibility: visible;">`
The HTML shows a loading mask (<div id="page-loading-mask">) that seems to block the click. Clicking works fine manually or through the Katalon IDE.
How can I make Selenium click the “Scans” tab reliably, even if there is a loading overlay? Is there a way to wait for the overlay to disappear or bypass it?
A common cause of ElementClickInterceptedException is a visible loading mask. In my projects,
I usually wait until that overlay is gone before clicking:
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20));
// Wait for the loading mask to disappear
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("page-loading-mask")));
// Now wait for the element to be clickable
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.linkText("Scans")));
element.click();
This approach ensures Selenium won’t try to click until the mask is gone, which makes it reliable even with dynamic loading.
To understand how WebDriverWait works, follow this guide on Selenium WebDriverWait
Sometimes, even after waiting, overlays or sticky headers still intercept clicks.
I’ve found using JavaScript to click works well in such cases:
WebElement element = driver.findElement(By.linkText("Scans"));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", element);
This bypasses the normal Selenium click entirely. I usually combine it with a wait for the element to be present so I don’t click too early.
In some flaky apps, the overlay disappears momentarily, but Selenium still throws an exception.
I often use a simple retry:
WebElement element = driver.findElement(By.linkText("Scans"));
int attempts = 0;
while(attempts < 5) {
try {
element.click();
break;
} catch (ElementClickInterceptedException e) {
Thread.sleep(500); // wait half a second before retry
attempts++;
}
}
This adds resilience to dynamic UIs without needing deep waits for every overlay.