Prakash P
Prakash P

Reputation: 441

getting Element is not clickable at point (355, 160) exception

My script is failing because of the following exception.

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (355, 160)

While loading the page if the element appears in the background, selenium tries to click and fails. I have used webdriverwait. Out of 10 times it fails around 3 times minimum.

How can I avoid/handle this without using Thread.sleep();

enter image description here

Upvotes: 2

Views: 456

Answers (2)

Saurabh Gaur
Saurabh Gaur

Reputation: 23805

You should wait until invisibility of element using invisibilityOfElementLocated as below :-

WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath('xpath of please wait loading...')));

After this you could perform click on target element

Hope it will work..:)

Upvotes: 4

selva
selva

Reputation: 1175

Use explicit wait

WebDriver driver = new FirefoxDriver();
driver.get("http://somedomain/url_that_delays_loading");
WebElement myElement = (new WebDriverWait(driver, 10))
  .until(ExpectedConditions.presenceOfElementLocated(By.id("myElement")));
// or (new WebDriverWait(driver, 10)).until(
    //    ExpectedConditions.visibilityOfElementLocated(By.id("myElement")));
myElement .click();

Upvotes: 0

Related Questions