Can nightwatch.js use usingServer from selenium-webdriver?

坚强是说给别人听的谎言 提交于 2021-01-29 01:43:04

问题


I have a suite of tests using local drivers built with nightwatch. Works well.

I am running a basic test using Perfecto Mobile and selenium-webdriver. It works with this example.(https://community.perfectomobile.com/series/20208/posts/1002862)

I am trying to connect my suite of nightwatch test to perfecto, but can't start selenium. If this is the url of the selenium server.

var url = "https://mobilecloud.perfectomobile.com/nexperience/perfectomobile/wd/hub";

I tried a few ways to set it up under nightwatch config, but can't make it work.

"selenium" : {
  "start_process" : true,
  "host" : "mobilecloud.perfectomobile.com/nexperience/perfectomobile/wd/hub"
}

Is there an equivalent to usingServer in nightwatch? I haven't seen anything in the docs.

driver = new webdriver.Builder().
  usingServer(url).
  withCapabilities(capabilities).
  build();

回答1:


Turns out this was the setup needed.

"test_settings" : {
  "perfecto" : {
    "use_ssl": true,
    "default_path_prefix": "/nexperience/perfectomobile/wd/hub",
    "selenium_port"  : 443,
    "selenium_host"  : "mobilecloud.perfectomobile.com",
    "desiredCapabilities": {
      "browserName": "xxx",
      "deviceName": "xxx",
      "user": "xxx@xxx.xxx",
      "password": "xxx",
      "platformName": "xxx"
    }
  }
}

The important part that didn't work at the time of writing the question: the default_path_prefix was not customizable.

/wd/hub was the default prefix. But I really needed /nexperience/perfectomobile/wd/hub.

Two days later, this commit was introduced. It is available in 0.9.5 release.

https://github.com/nightwatchjs/nightwatch/commit/aa24c2c2334c42388318498f654d8fe2957967d1



来源:https://stackoverflow.com/questions/37867425/can-nightwatch-js-use-usingserver-from-selenium-webdriver

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