Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
695 views
by The go-to Tester (222 points)
I am getting below exception while trying to click on an element.

org.openqa.selenium.WebDriverException: unknown error: Element Other element would receive the click

I am using Thread.sleep.

1 Answer

0 like 0 dislike
by The go-to Tester (222 points)
try {
new WebDriverWait(driver, duration).until(ExpectedConditions
.elementToBeClickable(by));
break;
} catch (StaleElementReferenceException e) {
e.printStackTrace();
}

try using above function

by The go-to Tester (222 points)
I am still facing the same issue, here is my code:

synchronized (driver)
 {
 driver.wait(2000);
 }
 try {
 new WebDriverWait(driver, 50).until(ExpectedConditions
 .elementToBeClickable(By.xpath("//html/body/div[2]/div/form/div[6]/div/div/div/button")));

 } catch (StaleElementReferenceException e) {
 e.printStackTrace();
 }
 //Click on Weight Graph "Cancel" button
 WebElement element11 = driver.findElement(By.xpath("//html/body/div[2]/div/form/div[6]/div/div/div/button"));
 Actions actions1 = new Actions(driver);
 actions1.moveToElement(element11).click();

-Sum


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

1.4k questions

1.6k answers

866 comments

1.9k users

...