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

388 views
Skip to first unread message

DanielB

unread,
Sep 20, 2019, 6:02:05 AM9/20/19
to NightwatchJs
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'

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.

Andrei Rusu

unread,
Sep 20, 2019, 8:13:07 AM9/20/19
to nightw...@googlegroups.com
Is the issue occurring locally on your machine or on a CI server?

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/38386a6b-4e01-4017-95be-91097b5868b5%40googlegroups.com.
Message has been deleted

benson tang

unread,
Nov 7, 2019, 9:13:42 AM11/7/19
to NightwatchJs
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 <//div[@id='doxMainLogin']> to be present for 60000 milliseconds. - expected "visible" but got: "not found"


Ed Sumerfield

unread,
Mar 4, 2020, 3:36:21 PM3/4/20
to NightwatchJs
Any update on this? I am getting the same results in Grid that work fine in Selenium Standalone. I suspect its a Selenium issue vs a nightwatch issue but wondered if you had found anything?


```
✖ Timed out while waiting for element <body> to be present for 30000 milliseconds. - expected "visible" but got: "not found" (30014ms)
    at Object.<anonymous> (.../nightwatch/BaseCommand.js:69:24)
    at process._tickCallback (internal/process/next_tick.js:68:7)
```

Selenium Standalone - geckodriver

```12:38:22.795 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session d6558ead-271f-a14d-a967-85052887b516 (org.openqa.selenium.firefox.GeckoDriverService)
1583257102833 webdriver::server DEBUG -> POST /session/d6558ead-271f-a14d-a967-85052887b516/url { "url": "http:\u002f\u002flocalhost:5000\u002fversion" }
1583257102834 Marionette DEBUG 0 -> [0,2,"WebDriver:Navigate",{"url":"http://localhost:5000/version"}]
1583257102840 Marionette TRACE [17] Received DOM event beforeunload for about:blank
1583257102855 Marionette TRACE [17] Received DOM event pagehide for about:blank
1583257102863 Marionette TRACE [17] Received DOM event DOMContentLoaded for http://localhost:5000/version
1583257102910 Marionette TRACE [17] Received DOM event pageshow for http://localhost:5000/version
1583257102929 Marionette DEBUG 0 <- [1,2,null,{"value":null}]
1583257102934 webdriver::server DEBUG <- 200 OK {"value":null}
1583257102953 webdriver::server DEBUG -> POST /session/d6558ead-271f-a14d-a967-85052887b516/elements { "value": "body", "using": "css selector" }
1583257102954 Marionette DEBUG 0 -> [0,3,"WebDriver:FindElements",{"using":"css selector","value":"body"}]
1583257102958 Marionette DEBUG 0 <- [1,3,null,[{"element-6066-11e4-a52e-4f735466cecf":"72499757-f7f6-974e-8286-a7e9377ec318"}]]
1583257102959 webdriver::server DEBUG <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"72499757-f7f6-974e-8286-a7e9377ec318"}]}
1583257102997 webdriver::server DEBUG -> POST /session/d6558ead-271f-a14d-a967-85052887b516/execute/sync {
 ```

 Successfully finds the "body" tag and continues with the test.

 Selenium Grid Node - same geckodriver

 ```12:33:48.426 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session cd002f65-7868-fd40-a972-60e262c0c472 (org.openqa.selenium.firefox.GeckoDriverService)
1583256828453 webdriver::server DEBUG -> POST /session/cd002f65-7868-fd40-a972-60e262c0c472/url {"url":"http://localhost:5000/version"}
1583256828456 Marionette DEBUG 0 -> [0,2,"WebDriver:Navigate",{"url":"http://localhost:5000/version"}]
1583256828461 Marionette TRACE [17] Received DOM event beforeunload for about:blank
1583256828472 Marionette TRACE [17] Received DOM event pagehide for about:blank
1583256828479 Marionette TRACE [17] Received DOM event DOMContentLoaded for http://localhost:5000/version
1583256828522 Marionette TRACE [17] Received DOM event pageshow for http://localhost:5000/version
1583256828526 Marionette DEBUG 0 <- [1,2,null,{"value":null}]
1583256828535 webdriver::server DEBUG <- 200 OK {"value":null}
1583256828555 webdriver::server DEBUG -> POST /session/cd002f65-7868-fd40-a972-60e262c0c472/elements {"using":"css selector","value":"body"}
1583256828562 Marionette DEBUG 0 -> [0,3,"WebDriver:FindElements",{"using":"css selector","value":"body"}]
1583256828568 Marionette DEBUG 0 <- [1,3,null,[{"element-6066-11e4-a52e-4f735466cecf":"e5c94ca4-e65e-f74a-afa8-b062ce7f2f53"}]]
1583256828569 webdriver::server DEBUG <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"e5c94ca4-e65e-f74a-afa8-b062ce7f2f53"}]}
1583256829080 webdriver::server DEBUG -> POST /session/cd002f65-7868-fd40-a972-60e262c0c472/elements {"using":"css selector","value":"body"}
1583256829081 Marionette DEBUG 0 -> [0,4,"WebDriver:FindElements",{"using":"css selector","value":"body"}]
1583256829083 Marionette DEBUG 0 <- [1,4,null,[{"element-6066-11e4-a52e-4f735466cecf":"e5c94ca4-e65e-f74a-afa8-b062ce7f2f53"}]]
1583256829084 webdriver::server DEBUG <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"e5c94ca4-e65e-f74a-afa8-b062ce7f2f53"}]}
```

Times out finding body tag.

Versions:

* Using: firefox (73.0.1) on mac 19.3.0 platform.
* geckodriver 0.26.0 (e9783a644016 2019-10-10 13:38 +0000)
* node_modules/selenium-server/lib/runner/selenium-server-standalone-3.141.59.jar

Exp phchen

unread,
Mar 12, 2020, 4:35:11 PM3/12/20
to NightwatchJs
To make issue easily to repro, I have prepared a simple repo that demo this issue.

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.
Run the same exact test cases locally (Mac + FF69) not using selenium grid,  we are able to run the test without any issues on Firefox.

We will try to spin up a Ubuntu and run the test locally on the Ubuntu + FF, and see if this has to deal with the operation system + browser combination..

Akbar Chandani

unread,
Sep 11, 2020, 7:38:52 PM9/11/20
to NightwatchJs
Hi All,

Anyone was able to resolve this issue. I am having the same problem

Thanks

davidlinse

unread,
Oct 4, 2020, 6:18:57 AM10/4/20
to NightwatchJs
do not rely on `<body>` but use another existing element on the page. (it's also written somewhere in the docs) 

best regards
~david

J Yang

unread,
Jan 8, 2021, 7:49:28 PM1/8/21
to NightwatchJs
I'm still having similar issue with geckodriver(0.27.0) and firefox(83.0). I can run tests on my mac(10.15.7) with selenium-standalone, but waitForElementPresent timeout on amazon linux. Any solution to this so far?
Reply all
Reply to author
Forward
0 new messages