nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.78k stars 1.31k forks source link

Guide/Wiki enhancement: selenium_host and selenium_port settings should not be used with Selenium Grid 3 #2109

Closed vlad-vinogradov closed 5 years ago

vlad-vinogradov commented 5 years ago

Using selenium_host and selenium_port settings change Nightwatch behavior and make it incompatible with Selenium Grid 3 and latest geckodriver and chromedriver versions
(tested on Nightwatch 1.1.11, Selenium Grid 3.141.59, Ubuntu).

I think this should be clarified somewhere in the Wiki or Configuration guide.

The following settings should be used for Firefox:

webdriver: {
  host: ... ,
  port: ... ,
  default_path_prefix: '/wd/hub',
},

The following settings should be used for Google Chrome >= 75
(and compatible chromedriver):

webdriver: {
  use_legacy_jsonwire: false,
  host: ... ,
  port: ... ,
  default_path_prefix: '/wd/hub',
},

The following settings may be used for Google Chrome < 75
(and compatible chromedriver):

webdriver: {
  use_legacy_jsonwire: true,
  host: ... ,
  port: ... ,
  default_path_prefix: '/wd/hub',
},
ajpetersons commented 5 years ago

I tried using these webdriver settings to run Chrome 75, but waitForElementVisible command is failing for me:

[..]
 → Running command: waitForElementVisible ('body', 10000)
   Request POST  /wd/hub/session/c7d26173023113a7a268898f3ad80c79/elements  
   { using: 'css selector', value: 'body' }
   Response 200 POST /wd/hub/session/c7d26173023113a7a268898f3ad80c79/elements (51ms)
   { value:
      [ { 'element-6066-11e4-a52e-4f735466cecf': 'dc40ff66-f430-4624-a581-919e9e058dee' } ] }
   Request GET  /wd/hub/session/c7d26173023113a7a268898f3ad80c79/element/dc40ff66-f430-4624-a581-919e9e058dee/displayed  
   Response 404 GET /wd/hub/session/c7d26173023113a7a268898f3ad80c79/element/dc40ff66-f430-4624-a581-919e9e058dee/displayed (5ms)
   { value:
      { error: 'unknown command',
        message:
         'unknown command: Cannot call non W3C standard command while in W3C mode',
        stacktrace: '#0 0x55eed9994299 <unknown>\n' } }
 Error while running .isElementDisplayed() protocol action: unknown command: Cannot call non W3C standard command while in W3C mode
[..]

Chromedrivers implementation page does not mention /session/{session id}/element/{element id}/displayed endpoint, so I am not sure if it is supposed to work.

vlad-vinogradov commented 5 years ago

... waitForElementVisible command is failing for me ... Chromedrivers implementation page does not mention /session/{session id}/element/{element id}/displayed endpoint

Yes, this is true. The latest chromedriver versions running in w3c mode no longer support displayed-endpoint. There is no such endpoint in the current W3C WebDriver specification:

It's optional (maybe appear as chromedriver protocol extension). This is another problem not directly related to this issue. But, of course, there should be some kind of solution for this one, because stable Chrome version may be changed at any time.

individual-it commented 5 years ago

I've opened a new issue for the second problem #2118 looks to me that I have the same one

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had any recent activity. If possible, please retry using the latest Nightwatch version and update the issue with any relevant details. If no further activity occurs, it will be closed. Thank you for your contribution.