Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium "Element is not clickable at point" error in Firefox

In regards to the Webdriver error

Element is not clickable at point (X, Y). Another element would recieve the click instead.

For ChromeDriver, this is addressed at Debugging "Element is not clickable at point" error, however the issue can occur in Firefox as well.

What are the best ways to resolve this when it occurs in FirefoxDriver?

like image 663
emery Avatar asked Apr 19 '16 22:04

emery


People also ask

How do I fix element is not clickable at point?

The exception “Element is not clickable at point” might be thrown when the element is not under focus or the action is being performed on the incorrect WebElement. In such cases, you have to switch to the actual element and perform the click action.

Why click is not working in Selenium?

We can list the most common reasons for click problems as being one of the following: Wrong web element locations. The existence of a web element that obscures the web element that we want to click. The Selenium WebDriver works much faster than the response of the application.

Is not clickable other element would receive the click?

WebDriverException - Element is not clickable at point (xx, xx). Other element would receive the click'. This happens when the element is loaded into the DOM, but the position is not fixed on the UI. There can be some other divs or images or ads that are not loaded completely.


1 Answers

This happens in the below cases-

  • When the element is loaded into the DOM, but the position is not fixed on the UI. There can be some other div or images that are not loaded completely.

  • The page is getting refreshed before it is clicking the element.

Workaround

  • Use Thread.sleep before actions on each web element in UI, but it is not a good idea.
  • Use WebDriverWait ExpectedConditions.

I was facing the same issue, the page load time was more and a loading icon was overlapping on entire web page.

To fix it, I have implemented WebDriverWait ExpectedConditions, which waits for the loading icon to disappear before performing click action on an element

Call this function before performing an action (I am using data driven framework)

public void waitForLoader () throws Exception  {
  try {
   String ObjectArray[]=ObjectReader.getObjectArray("LoadingIcon"); 
    if(checkElementDisplayed(ObjectArray[3],ObjectArray[2]))
    {
     WebDriverWait wait = new WebDriverWait(remotewebdriver,10); 
     wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath(ObjectArray[3])));
    }
   } catch (NoSuchElementException e) {
   System.out.println("The page is loaded successfully");
   }
  }
like image 90
Joe Avatar answered Sep 21 '22 01:09

Joe