Nightwatch can't locate element via css id or class selectors

天涯浪子 提交于 2019-12-05 04:06:26

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 :-).

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]');
  }
};

Not sure if helps, but I stumble upon this issue today and got it working after awhile.

By default nightwatch is using the css selector so just adding ".useXpath()" fixed my issue. So, check which selector you are using first and then use the required one.

Source : https://github.com/nightwatchjs/nightwatch-docs/blob/master/guide/using-nightwatch/using-xpath-selectors.md

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!