Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed: unknown error: Element is not clickable at point (x, x) - Angular/Protractor

I've been going through an Angular app I'm working on, testing out CRUD functionality using Protractor for all the different parts of the app. All CRUD pages have create/edit buttons, and the buttons, regardless of what page you're on, all open the same modal whether they are creating or editing.

I am inconsistently running into the issue above. I literally will run the test and it will give me this error and not open the modal, then I'll run it again, and it will open the modal and the same exact test will pass. Then try again to make sure and it fails again. ETC

It's pretty annoying to have the only issues with your tests seem to be an issue with the browser/test suite, and not the actual code. Just to be clear I'm testing this in Chrome.

What would be the way of handling this type of issue, where the problem is the inconsistency of the passing and failing? It's unclear to me exactly what setting needs to be fixed.

like image 396
jtbitt Avatar asked Dec 24 '15 01:12

jtbitt


People also ask

What do you do when an element is not clickable?

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.

How do you click on a non clickable element in selenium?

The solution is to make sure that the overlapping element is closed before you try to click on another element. Another solution is to switch to the layer that contains the element you want to click.

Is not clickable at point because another element obscures it selenium?

We can get the error - Element is not clickable at point while trying to click a link in Selenium webdriver. This is common in chromedriver as the Chrome browser determines an element with point location. When the position of an element is changing and we make an attempt to click on it, this error is encountered.


1 Answers

It is difficult to say without seeing and running your actual tests, but here are things to try:

  • maximize the browser window:

    browser.driver.manage().window().maximize();
    
  • disable all angular animations

  • increase the implicit wait timeout
  • use elementToBeClickable built-in Expected Condition:

    var EC = protractor.ExpectedConditions;
    var elm = element(by.id("myelement"));
    
    browser.wait(EC.elementToBeClickable(elm), 5000);
    
  • scroll into view of the element before clicking it:

    browser.executeScript("arguments[0].scrollIntoView();", elm.getWebElement());
    
  • move to element before clicking:

    browser.actions().mouseMove(elm).click(elm).perform();
    
  • click via javascript:

    browser.executeScript("arguments[0].click();", elm.getWebElement());
    
like image 84
alecxe Avatar answered Oct 20 '22 05:10

alecxe