Skip to content Skip to sidebar Skip to footer

Nightwatch Can't Locate Element Via Css Id Or Class Selectors

We're using Nightwatch to automate some of our UI testing. Some of the current tests are rather brittle, mostly having to do with weird CSS selectors, and I'm trying to simplify th

Solution 1:

For what it's worth, we ended up abandoning Nightwatch, and going straight to Selenium (C#, in our case), which didn't seem to have these problems, and integrated better into the rest of our environment. Not a great answer, but I don't have this problem anymore :-).

Solution 2:

I have just started using NightWatch JS , I am using nightwatch v0.6.7 . Following code is working fine for me

module.exports = { 
  '1. test' : function (browser) {
    browser
      .url('<your url>')
      .waitForElementVisible('select[id=crm-result-visit]',1000)
      .click('select[id=crm-result-visit]');
  }
};

Solution 3:

Try setting the CSS selector explicitly before your actions:

browser.useCss();

browser.waitForElementVisible('.btn-crm', 10000);

Post a Comment for "Nightwatch Can't Locate Element Via Css Id Or Class Selectors"