Nightwatch: Firefox : Timed out while waiting for element <body> (JSONWire protocol ?)

Created on 19 Sep 2019  Â·  10Comments  Â·  Source: nightwatchjs/nightwatch

Hello, I have a specific issue about visible dom on my test in nightwatch with firefox (resolved with chrome).

  Timed out while waiting for element <body> to be present for 5000 milliseconds. - expected "visible" but got: "not found"
       at Object.Demo test Google (/usr/src/app/tests/google.js:10:17)
       at <anonymous>
       at process._tickCallback (internal/process/next_tick.js:188:7)

All function on element of dom have the same crash ! browser.click(..) etc...

I had the same issue with chrome but I have resolved with a parameter in configuration :

chromeOptions: {
        w3c: false
    },

I think I have the same problem with firefox but not sure about JSONWire protocol ??

My versions :

nightwatch v1.2.3
chromedriver 77.0.0
geckodriver 1.17.0

My conf :

const args = require('minimist')(process.argv);

let grid = args['grid'] === 'true';

// firefox setting
let FIREFOX_CONFIGURATION = {
    browserName: 'firefox',
    javascriptEnabled: true,
    acceptSslCerts: true,
    loggingPrefs: {"driver": "INFO", "server": "OFF", "browser": "INFO"},
};

// chrome setting
let CHROME_CONFIGURATION = {
    browserName: 'chrome',
    chromeOptions: {
        w3c: false
    },
    javascriptEnabled: true,
    acceptSslCerts: true,
    loggingPrefs: {"driver": "INFO", "server": "OFF", "browser": "INFO"}
};

// settings
module.exports = {
    src_folders: ['tests'],
    output_folder: 'reports/output',
    globals_path: "globals_path.js",
    webdriver: {
        "start_process": grid
    },
    test_settings: {
        default: {
            "log_path": "reports/logs",
            selenium_port: 4444,
            selenium_host: "hub",
            silent: true,
            screenshots: {
                enabled: true,
                path: "reports/screenshots",
                on_failure: true,
                on_error: true
            },

        },

        "chrome" : {
            "webdriver": {
                "server_path": "./nodes_modules/.bin/chromedriver",
                "cli_args": [
                    "--verbose"
                ]
            },

            desiredCapabilities: CHROME_CONFIGURATION
        },

        "firefox" : {
            "webdriver": {
                "server_path": "./nodes_modules/.bin/geckodriver",
                "cli_args": [
                    "--verbose"
                ]
            },

            desiredCapabilities: FIREFOX_CONFIGURATION
        },

        "selenium_server" : {
            "selenium" : {
                "start_process": grid,
                "post": 4444,
                "server_path": "./node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.141.59.jar",
                "cli_args": {
                    "webdriver.gecko.driver": "./node_modules/.bin/geckodriver",
                    "webdriver.chrome.driver": "./node_modules/.bin/chromedriver",
                    "webdriver.ie.driver":""
                }
            },

            desiredCapabilities: CHROME_CONFIGURATION
        }
    }
};

My test :

'use strict'

// taken from http://nightwatchjs.org/guide
module.exports = {

    'Demo test Google' : function (browser) {

        browser.url('https://www.google.com');
        browser.assert.title('Google');
        browser.waitForElementVisible('body', 5000);
        browser.assert.elementPresent('body');
        browser.expect.element('body').to.be.visible;
        browser.setValue('input[type=text]', 'nightwatch');
        browser.assert.value('input[type=text]', 'nightwatch');
        browser.click('input[name="btnK"]');
        browser.end();

    }

};

I don't use standalone but selenium-grid with docker. Grid console : v.3.141.59.

Can you help me ? I have searched a lot of tilme on the web, I'm desperate.

Most helpful comment

For those who is interested, we initially thought it was firefox profile issue on the grid (https://github.com/SeleniumHQ/docker-selenium, Ubuntu + FF69) thought we are able to created profile on the FF using docker but still seeing waitForElementPresent issue.
And if we do the run locally (Mac + FF69) we observe we are able to run the test without any issues.

All 10 comments

Did you try posting on the Mailing List or StackOverflow? The GitHub Issues list is meant for submitting bugs and feature requests.

I understand but for me it's an issue. There is no documentation and no specification on this problem.

I had post this issue on stackoverflow this morning, see here

Ok, I can try and help you on the Mailing List. Could you post it there?

Great, thanks. I'm closing this now.

any solution?

i get the exact same issue

i solve the issue in chrome by adding :
chromeOptions: {
w3c: false
},

but in IE, it can not find any solution for it

i use
nightwatch: v1.2.4
selenium grid with selenium-server-standalone-3.141.59.jar

for the verbose log, the element is found, but finally it still shown "not found" error

{ using: 'xpath', value: "//div[@id='doxMainLogin']" }

Response 200 POST http://172.20.10.189:4444/wd/hub/session/6920cb2b01e269dd721e4cf927f74758/elements (9ms)

{ value:

  [ { 'element-6066-11e4-a52e-4f735466cecf': '99ccec56-3f14-42d8-843f-ea1229f93b73' } ] }

✖ Timed out while waiting for element

Hello, that issue is already exists. We need a solution for that.

Firefox does not found anything?!

 desiredCapabilities: {
        browserName: 'firefox',
        acceptInsecureCerts: true,
        javascriptEnabled: true
      }

For those who is interested, we initially thought it was firefox profile issue on the grid (https://github.com/SeleniumHQ/docker-selenium, Ubuntu + FF69) thought we are able to created profile on the FF using docker but still seeing waitForElementPresent issue.
And if we do the run locally (Mac + FF69) we observe we are able to run the test without any issues.

For those who is interested, we initially thought it was firefox profile issue on the grid (https://github.com/SeleniumHQ/docker-selenium, Ubuntu + FF69) thought we are able to created profile on the FF using docker but still seeing waitForElementPresent issue.
And if we do the run locally (Mac + FF69) we observe we are able to run the test without any issues.

me too

For those who is interested, we initially thought it was firefox profile issue on the grid (https://github.com/SeleniumHQ/docker-selenium, Ubuntu + FF69) thought we are able to created profile on the FF using docker but still seeing waitForElementPresent issue.
And if we do the run locally (Mac + FF69) we observe we are able to run the test without any issues.

I am experiencing the same behavior exactly. In #2521, this comment mentions that updating docker selenium grid to version 4 might be helpful.

Was this page helpful?
0 / 5 - 0 ratings