nightwatch: waitForElementVisible failed with chromedriver 75.0.3770.8

Looks like Nightwatch 1.1.7 doesn’t recognize the new W3C response/identifier format:

{ value:
   [ { 'element-6066-11e4-a52e-4f735466cecf': 'c125c68d-c4da-4422-abf5-04757feb6961' } ] }

testGoogle.js:

module.exports = {
  'Demo test Google' : function (browser) {
    browser
      .url('https://www.google.com')
      .waitForElementVisible('body', 4000)
      .setValue('input[type=text]', 'nightwatch')
      .waitForElementVisible('input[name=btnK]', 5000)
      .click('input[name=btnK')
      .pause(3000)
      .assert.containsText('#search', 'Nightwatch.js')
      .end();
  }
};

Here is the output from Nightwatch:

   Request POST  /wd/hub/session
   { desiredCapabilities:
      { browserName: 'chrome',
        acceptSslCerts: true,
        platform: 'ANY',
        applicationName: 'chrome-unstable',
        javascriptEnabled: true,
        name: 'Test Google' } }
   Response 200 POST /wd/hub/session (808ms)
   { value:
      { sessionId: 'f07a12f028be56fe188dd3de20e54cfe',
        capabilities:
         { acceptInsecureCerts: false,
           browserName: 'chrome',
           browserVersion: '75.0.3770.18',
           chrome:
            { chromedriverVersion:
               '75.0.3770.8 (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770@{#40})',
              userDataDir: '/tmp/.com.google.Chrome.SgGWNM' },
           'goog:chromeOptions': { debuggerAddress: 'localhost:37693' },
           networkConnectionEnabled: false,
           pageLoadStrategy: 'normal',
           platformName: 'linux',
           proxy: {},
           setWindowRect: true,
           strictFileInteractability: false,
           timeouts: { implicit: 0, pageLoad: 300000, script: 30000 },
           unhandledPromptBehavior: 'dismiss and notify',
           'webdriver.remote.sessionid': 'f07a12f028be56fe188dd3de20e54cfe' } } }
 Received session with ID: f07a12f028be56fe188dd3de20e54cfe

 -> Running [before]:
 -> Completed [before].
Running:  Demo test Google

 -> Running [beforeEach]:
 -> Completed [beforeEach].
 
 -> Running command: url ('https://www.google.com')
   Request POST  /wd/hub/session/f07a12f028be56fe188dd3de20e54cfe/url  
   { url: 'https://www.google.com' }
   Response 200 POST /wd/hub/session/f07a12f028be56fe188dd3de20e54cfe/url (3378ms)
   { value: null }
 -> Completed command url ('https://www.google.com') (3381ms)
 
 -> Running command: waitForElementVisible ('body', 4000)
   Request POST  /wd/hub/session/f07a12f028be56fe188dd3de20e54cfe/elements  
   { using: 'css selector', value: 'body' }
   Response 200 POST /wd/hub/session/f07a12f028be56fe188dd3de20e54cfe/elements (35ms)
   { value:
      [ { 'element-6066-11e4-a52e-4f735466cecf': 'c125c68d-c4da-4422-abf5-04757feb6961' } ] }
   Request POST  /wd/hub/session/f07a12f028be56fe188dd3de20e54cfe/elements  
   { using: 'css selector', value: 'body' }
   Response 200 POST /wd/hub/session/f07a12f028be56fe188dd3de20e54cfe/elements (29ms)
   { value:
      [ { 'element-6066-11e4-a52e-4f735466cecf': 'c125c68d-c4da-4422-abf5-04757feb6961' } ] }

...

And here is successful output when using chromedriver 74.0.3729.6: …

...
 -> Running command: waitForElementVisible ('body', 1000)
   Request POST  /wd/hub/session/7f35786ac6089c26120693e2f33680ce/elements  
   { using: 'css selector', value: 'body' }
   Response 200 POST /wd/hub/session/7f35786ac6089c26120693e2f33680ce/elements (39ms)
   { sessionId: '7f35786ac6089c26120693e2f33680ce',
     status: 0,
     value: [ { ELEMENT: '0.8304314778554673-1' } ] }
   Request GET  /wd/hub/session/7f35786ac6089c26120693e2f33680ce/element/0.8304314778554673-1/displayed  
   Response 200 GET /wd/hub/session/7f35786ac6089c26120693e2f33680ce/element/0.8304314778554673-1/displayed (28ms)
   { sessionId: '7f35786ac6089c26120693e2f33680ce',
     status: 0,
     value: true }
V Element <body> was visible after 70 milliseconds.
 -> Completed command waitForElementVisible ('body', 1000) (73ms)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

It does.

However, Chrome (stable) still uses JSONWire protocol so we cannot switch yet to full W3C Webdriver. But you can try to switch manually by setting:

webdriver: {
  use_legacy_jsonwire: true
}

https://github.com/nightwatchjs/nightwatch/blob/master/lib/settings/defaults.js#L109