close

[Solved] org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode

Hello Guys, How are you all? Hope You all Are Fine. Today I am facing the following error org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode in Java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode Error Occurs?

Today I am facing the following error org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode in Java.

How To Solve org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode Error ?

  1. How To Solve org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode Error ?

    To Solve org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode Error Answer is to explicitly wait with javascript executor. This combination is working for me:

  2. org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode

    To Solve org.openqa.selenium.ElementClickInterceptedException: element click intercepted error using Selenium and Java in headless mode Error Answer is to explicitly wait with javascript executor. This combination is working for me:

Solution 1

Try adding an explicit wait

WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//label[@formcontrolname='reportingDealPermission']"))).click();

and if this doesn’t work then try using the JS Executor

WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//label[@formcontrolname='reportingDealPermission']"))); 
((JavascriptExecutor)driver).executeScript("arguments[0].click();", element);

Solution 2

For this issue:

org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <label _ngcontent-yrc-c26="" formcontrolname="reportingDealPermission" nz-checkbox="" class="ant-checkbox-wrapper ng-untouched ng-pristine ng-valid" ng-reflect-name="reportingDealPermission">...</label> is not clickable at point (161, 562).

Another element receives the click:

Answer is to explicitly wait with javascript executor. This combination is working for me:

WebDriverWait wait = new WebDriverWait(driver, 10);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//label[@formcontrolname='reportingDealPermission']"))); 
((JavascriptExecutor)driver).executeScript("arguments[0].click();", element);

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read