0

Hi all I'm having some issues with interacting with a table in my e2e scripts. element(by.css('#topic_0')).click(); When I'm in my dev environment I am able to interact with it just fine, but when I interact with it when I switch over to my test env I get this error. Failed: element click intercepted element id="topic_0" is not clickable at point (x,x). other element would receive the click id="topics_table" This is how I login into my test env

 browser.waitForAngularEnabled(false);
    browser.get(browser.baseUrl);
    browser.sleep(10000);
    browser.findElement(by.id('userID')).sendKeys(browser.params.login.user);
    browser.findElement(by.id('password')).sendKeys(browser.params.login.password);
    browser.findElement(by.name('submitButton')).click();
    browser.waitForAngularEnabled(true);

1 Answers1

0

The error Failed: element click intercepted element id="topic_0" is not clickable at point (x,x). other element would receive the click id="topics_table" usually happens when protractor fails to locate the targeted element (in your case you're targeting an element which has the #topic_0 css; from your above code element(by.css('#topic_0')))...

Protractor mostly fails to locate an element when you don't deal with promises. I'm assuming that the element you're trying to click is not yet available on the DOM, and protractor is clicking another element instead... the issue has nothing to do with environments. Maybe in your case the test environment is just slower than the dev environment, which is why it is working on dev, but not on the test environment.

I would say use one of the expectedConditions i.e. the visibilityOf expectedConditions, so that your code ends up waiting for the element to be displayed on the DOM... so your code will be something as follows:

var EC = protractor.ExpectedConditions;
// Waits for the element with id 'topic_0' to be visible on the dom.
browser.wait(EC.visibilityOf($('#topic_0')), 5000);
element(by.css('#topic_0')).click();

to note that when using CSS Selectors as a locator, you can use the shortcut $() notation:

$('my-css');
// Is the same as:
element(by.css('my-css'));
Gėorge
  • 43
  • 1
  • 10