Fetching session with nightwatch v0.9.20, selenium 3.11.0
Request: POST http://localhost:4444/wd/hub/session
{ desiredCapabilities:
{ browserName : 'firefox',
javascriptEnabled: true,
acceptSslCerts: true,
platform:'ANY',
acceptInsecureCerts: true,
elementScrollBehavior: 1,
idleTimeout: 300 }}
Response 200 POST http://localhost:4444/wd/hub/session
{ status: 0,
sessionId: '7b53710dee0b6f74a3a71df47aff2fc9',
value:
{ capabilies... }
Fetching session with v1.0.4, selenium 3.11.0
Request POST http://localhost:4444 /session
{ desiredCapabilities:
{ browserName: 'firefox',
acceptSslCerts: true,
platform: 'ANY',
javascriptEnabled: true,
acceptInsecureCerts: true,
elementScrollBehavior: 1,
idleTimeout: 300 }
Response 200 POST http://localhost:4444/session
{ status: -1,
value: '<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <link rel="stylesheet" type="text/css" href="/assets/displayhelpservlet.css" media="all"/>\n <link href="/assets/favicon.ico" rel="icon" type="image/x-icon" />\n <script src="/assets/jquery-3.1.1.min.js" type="text/javascript"></script>\n <script src="/assets/displayhelpservlet.js" type="text/javascript"></script>\n <script type="text/javascript">\n var json = Object.freeze(\'{"consoleLink":"/grid/console","type":"Grid Hub","version":"3.11.0","class":"org.openqa.grid.web.servlet.DisplayHelpServlet$DisplayHelpServletConfig"}\');\n </script>\n</head>\n<body>\n\n<div id="content">\n <div id="help-heading">\n <h1><span id="logo"></span></h1>\n <h2>Selenium <span class="se-type"></span> v.<span class="se-version"></span></h2>\n </div>\n\n <div id="content-body">\n <p>\n Whoops! The URL specified routes to this help page.\n </p>\n <p>\n For more information about Selenium <span class="se-type"></span> please see the\n <a class="se-docs">docs</a> and/or visit the <a class="se-wiki">wiki</a>.\n <span id="console-item">\n Or perhaps you are looking for the Selenium <span class="se-type"></span> <a class="se-console">console</a>.\n </span>\n </p>\n <p>\n Happy Testing!\n </p>\n </div>\n\n <div>\n <footer id="help-footer">\n Selenium is made possible through the efforts of our open source community, contributions from\n these <a href="https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS">people</a>, and our\n <a href="http://www.seleniumhq.org/sponsors/">sponsors</a>.\n </footer>\n </div>\n </div>\n\n</body>\n</html>' }
I can't seem to retrieve any session without the /wh/hub path
Could you share your config please?
I have a selenium server (zalenium) hosted in aws.
{
"src_folders": [
"C:\\Users\\kcid\\nightwatch\\scripts"
],
"custom_commands_path": "C:\\Users\\nightwatch\\custom-commands",
"custom_assertions_path": "C:\\Users\\kcid\\nightwatch\\custom-assertions",
"waitForConditionPollInterval": 200,
"test_settings": {
"default": {
"selenium": {
"start_process": false,
"host": "selenium-docker.service.ccp.org",
"port": "4445"
},
"silent": true,
"disable_colors": true,
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"acceptInsecureCerts": true,
"elementScrollBehavior": 1
},
"request_timeout_options": {
"timeout": 300000
}
}
}
}
I was able to run tests after modifying nightwatch's /lib/protocol/transport.js
get defaultPathPrefix() {
return '/wd/hub';
}
Yes, I see the problem. You can also fix it by explicitly setting "default_path_prefix" : "/wd/hub" in the "selenium" settings, which should be set by default for selenium.
I see, that solves it.
Tried running my script on firefox and got this response from verbose logging.
Selenium v3.11.0, Firefox v59.0.2, Nightwatch v1.0.4
Request POST http://selenium-docker:4445/wd/hub/session/8a183f25-3d58-436e-8ce5-b46af3c5c220/execute
{ script: 'return document.readyState;', args: [] }
Response 404 POST http://selenium-docker:4445/wd/hub/session/8a183f25-3d58-436e-8ce5-b46af3c5c220/execute (654ms)
{ value:
{ error: 'unknown command',
message: 'POST /session/8a183f25-3d58-436e-8ce5-b46af3c5c220/execute did not match a known command',
stacktrace: '' } }
Error while running .executeScript() protocol action: POST /session/8a183f25-3d58-436e-8ce5-b46af3c5c220/execute did not match a known command
Everything works on chrome as expected.
I can put this in a separate issue.
This is exactly what I have been experiencing with nightwatch against Firefox + selenium.
@kmcid Please create a separate issue so that @beatfactor can see this issue more clearly :)
Thanks!
Could you please verify this with v1.0.6?
@beatfactor So after v1.0.6, testing against firefox gives:
An occurred error while retrieving a new session.
Settings:
"src_folders": [
"tests"
],
"output_folder": "./reports",
"page_objects_path": "./page-objects",
"webdriver": {
"default_path_prefix": "/wd/hub",
"ssl": true
},
"test_settings": {
"default": {
"selenium": {
"start_process": false,
"host": "selenium.xxx.com",
"port": 443
},
"desiredCapabilities": {
"browserName": "chrome"
}
},
"firefox": {
"desiredCapabilities": {
"browserName": "firefox",
"acceptInsecureCerts": true
}
}
}
This should be fixed in v1.0.12. Please open a new issue if the problem still persists.
@beatfactor It still persists. See my comment: https://github.com/nightwatchjs/nightwatch/issues/1874#issuecomment-438250024