0

I have been setting up some tests with Nightwatch. I ran the following basic test on their website.

module.exports = {
    'Search on google': (browser) => {
        browser
            .url('http://www.google.com')
            .waitForElementVisible('body', 1000)
            .setValue('input[type=text]', 'nightwatch')
            .waitForElementVisible('button[name=btnG]', 1000)
            .click('button[name=btnG]')
            .pause(1000)
            .assert.containsText('#main', 'Night Watch')
            .end()
    },
    after: (browser) => {
        browser.end()
    } 
};

And got the following error:

Timed out while waiting for element <button[name=btnG]> to be visible for 1000 milliseconds. - expected "visible" but got: "not visible"

My first attempt at correcting was to change .waitForElementVisible('button[name=btnG]', 1000) to 10000 but still ended up getting Timed out while waiting for element <button[name=btnG]> to be visible for 10000 milliseconds. - expected "visible" but got: "not visible".

Inspecting the google search button showed me that the button name was actually btnK so I tested that but it didn't work either returning expected "visible" but got: "not found".

Very stumped and not sure where to go from here. Anyone have an idea?

2 Answers2

0

Any chance you're running this on Chrome 65? A recent change essentially causes setValue to error out. Your Nightwatch test would then fail on the next step. The best solution is to update your Chromedriver to 2.36.

Please see the answers here: unknown error: call function result missing 'value' for Selenium Send Keys even after chromedriver upgrade

  • Wow, this actually helped out a lot. I wasn't able to find this in my search earlier but thank you so much. It worked out! – Jonathan Mai Mar 15 '18 at 03:36
0

I was facing the same issue. I had installed ChromeDriver from NPM it was v2.45.. My Chrome version was v69. When I downloaded the chrome driver from this link- https://chromedriver.storage.googleapis.com/index.html?path=2.36/ and updated my nightwatch.json to point to this downloaded chrome driver version using server_path. This solved the issue.

Kunal Patil
  • 745
  • 1
  • 9
  • 18