Nightwatch : Error retrieving a new session from the selenium server -
i have simple test open launch_url in chrome. getting error cannot retrieve new session.
also know how can use nightwatch without running in grid. standalone instance.
below configuration have used.
{ "src_folders" : ["tests"], "output_folder" : "reports", "custom_commands_path" : "", "custom_assertions_path" : "", "page_objects_path" : "", "globals_path" : "", "selenium" : { "start_process" : false, "server_path" : "./bin/selenium-server-standalone-3.4.0.jar", "log_path" : "", "port" : 4444, "cli_args" : { "webdriver.chrome.driver" : "./bin/chromedriver.exe", "webdriver.gecko.driver" : "", "webdriver.edge.driver" : "" } }, "test_settings" : { "default" : { "launch_url" : "http://127.0.0.1", "selenium_port" : 4444, "selenium_host" : "127.0.0.1", "silent": true, "screenshots" : { "enabled" : false, "path" : "" }, "desiredcapabilities": { "browsername": "firefox", "marionette": true } }, "chrome" : { "desiredcapabilities": { "browsername": "chrome", "javascriptenabled": true, "acceptsslcerts": true } }, "edge" : { "desiredcapabilities": { "browsername": "microsoftedge" } } } } when run nightwatch using command nightwatch --env chrome or nightwatch, gives me below error
[test1] test suite ====================== running: demo test http://127.0.0.1 error retrieving new session selenium server connection refused! selenium server started? { status: 13, value: { message: 'error forwarding new session empty pool of vm setup capabilities [{acceptsslcerts=true, marionette=true, name=test1, browsername=chrome, javascriptenabled=true, platform=any}]', class: 'org.openqa.grid.common.exception.gridexception' } } my test looks like
module.exports = { 'demo test' : function (browser) { console.log(browser.launchurl); browser .url(browser.launchurl) .end(); } }; i can see launch url been logged console, browser not starting. using latest jar file , chromedriver binary.
i gave try , here's have figured out
in selenium configuration section seeing have set start_process false.
"selenium" : { "start_process" : false, "server_path" : "./bin/selenium-server-standalone-3.4.0.jar", "log_path" : "", "port" : 4444, "cli_args" : { "webdriver.chrome.driver" : "./bin/chromedriver.exe", "webdriver.gecko.driver" : "", "webdriver.edge.driver" : "" } }, when have value false, can rid of section (because not going used @ per configuration)
you telling nightwatch shouldn't try , start selenium-server should connect selenium server running on port 4444 (these values obtained default section of test_settings section
"default" : { "launch_url" : "http://www.google.com", "selenium_port" : 4444, "selenium_host" : "127.0.0.1", "silent": false, "screenshots" : { "enabled" : false, "path" : "" }, "desiredcapabilities": { "browsername": "firefox", "marionette": true } }, so far good. before ran nightwatch command guessing started selenium server in incorrect mode.
i think started server using below command
java -jar selenium-server-standalone-3.4.0.jar -role hub
this causes hub started. hub manager. cannot work (of launching browsers, opening urls, typing texts, clicking links etc) on own. needs node available can route of work node.
the error error forwarding new session empty pool of vm setup capabilities [{acceptsslcerts=true, marionette=true, name=nightwatchtest, browsername=firefox, javascriptenabled=true, platform=any}]' selenium grid's way of telling you, haven't wired in nodes route traffic to.
so in order fix issue, can 1 of following:
- start selenium server in standalone mode [neither hub or node], using command
java -jar selenium-server-standalone-3.4.0.jar(or) - flip flag
start_processtruein configuration file, cause nightwatch start , stop server on own.
Comments
Post a Comment