Closed chriscuba23 closed 3 years ago
@chriscuba23 can you check on 1.7.6? Also can you please post the output of running nightwatch --verbose
? We've posted the xml ouput
But since the hub is running on your CI machine, should you be setting the selenium host to 127.0.0.1?
@beatfactor I commented the selenium host and uploaded the verbose output @ debug.log
And it was working fine in v1.6?
@chriscuba23 what does
curl localhost:4444/wd/hub/status
or
curl localhost:4444/status
give you ? also please try and remove
launch_url
And it was working fine in v1.6?
Yes, 1.6.4 can run Selenium Grid with no problem
@chriscuba23 what does
curl localhost:4444/wd/hub/status
or
curl localhost:4444/status
give you ? also please try and remove
launch_url
{
"status": 0,
"value": {
"ready": true,
"message": "Hub has capacity",
"build": {
"revision": "aacccce0",
"time": "2018-08-02T20:13:22.693Z",
"version": "3.14.0"
},
"os": {
"arch": "amd64",
"name": "Linux",
"version": "3.10.0-1160.6.1.el7.x86_64"
},
"java": {
"version": "1.8.0_272"
}
}
@Dharin-shah still the same connection error occurs even when removing launch_url
Error: An error occurred while retrieving a new session -- 22-Jun-2021 15:00:56 | at endReadableNT (_stream_readable.js:1081:12)@beatfactor I commented the selenium host and uploaded the verbose output @ debug.log
You still need to set the selenium host. I was just confused about why it is set to localhost since the grid is running on the CI (I don't have a lot of experience with using the Grid). But if you're saying that it runs locally as a node, then you should keep the host set as localhost.
it is set to localhost since the hub lies on the ci machine. The configuration file exists on the ci machine so it tells to trigger the hub that is running there... Do you think a node or selenium update will do the trick?
I'm afraid I'm still a bit confused about your setup. Can you post your entire nightwatch.conf.js again please?
@Dharin-shah @beatfactor I've posted the entire conf.js at the Configuration above
can you try adding:
webdriver: {
start_process: false,
}
in your selenium.chrome
environment please?
@beatfactor this did the trick! Thank you!
So the issue was that it was inheriting the "start_process: true" from the default environment?
@beatfactor this did the trick! Thank you!
So the issue was that it was inheriting the "start_process: true" from the default environment?
Yes. I think it started happening in 1.7 because we added multiple inheritance levels.
Describe the bug
I am using Selenium Grid 3.14.0 and I am unable to connect to the Selenium hub using the new nightwatch.conf.js
Hub and nodes are up and running, which means that the nodes are registered to the hub.
Hub is running on our CI machine with: java -jar selenium-server-standalone-3.14.0.jar -role hub
Nodes are running on virtual machines with: java -jar selenium-server-standalone-3.14.0.jar -role node -hub http://********/grid/register
I am using the 'selenium.chrome' environment of the new configuration file as the environment to run the tests on the CI machine: the Selenium Server that acts as a hub exists on the same machine as CI is
start_process is set to false since the selenium server is already running
Run with command
Verbose output
debug.log
```txt build 22-Jun-2021 12:12:33 Running smoke tests on Selenium grid build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 [1 Registration/1 4 Non Registered] Test Suite build 22-Jun-2021 12:12:36 ============================================== error 22-Jun-2021 12:12:36 - Connecting to localhost on port 4444... error 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 Request POST /session build 22-Jun-2021 12:12:36 { desiredCapabilities: build 22-Jun-2021 12:12:36 { browserName: 'chrome', build 22-Jun-2021 12:12:36 javascriptEnabled: true, build 22-Jun-2021 12:12:36 acceptSslCerts: true, build 22-Jun-2021 12:12:36 name: '1 Registration/1 4 Non Registered', build 22-Jun-2021 12:12:36 'goog:chromeOptions': build 22-Jun-2021 12:12:36 { w3c: false, build 22-Jun-2021 12:12:36 args: build 22-Jun-2021 12:12:36 [ '--no-sandbox', build 22-Jun-2021 12:12:36 '--ignore-certificate-errors', build 22-Jun-2021 12:12:36 '--allow-insecure-localhost', build 22-Jun-2021 12:12:36 '--headless', build 22-Jun-2021 12:12:36 '--disable-gpu', build 22-Jun-2021 12:12:36 '--disable-software-rasterizer', build 22-Jun-2021 12:12:36 '--window-size=1920,925', build 22-Jun-2021 12:12:36 '--log-level=3' ] } } } build 22-Jun-2021 12:12:36 Response 404 POST /session (33ms) build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36
build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36build 22-Jun-2021 12:12:36
Selenium v.
build 22-Jun-2021 12:12:36build 22-Jun-2021 12:12:36 Whoops! The URL specified routes to this help page. build 22-Jun-2021 12:12:36
build 22-Jun-2021 12:12:36build 22-Jun-2021 12:12:36 For more information about Selenium please see the build 22-Jun-2021 12:12:36 docs and/or visit the wiki. build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36 Or perhaps you are looking for the Selenium console. build 22-Jun-2021 12:12:36 build 22-Jun-2021 12:12:36
build 22-Jun-2021 12:12:36build 22-Jun-2021 12:12:36 Happy Testing! build 22-Jun-2021 12:12:36
build 22-Jun-2021 12:12:36Configuration
nightwatch.conf.js
```js // Autogenerated by Nightwatch // Refer to the online docs for more details: https://nightwatchjs.org/gettingstarted/configuration/ const Services = {}; loadServices(); require('dotenv').config(); const FAILURES_ERRORS_PATH = "./failures"; // Location of the screenshots taken on failures/errors const REPORTS = "./reports"; // The location where the JUnit XML report files will be saved. module.exports = { // An array of folders (excluding subfolders) where your tests are located; // if this is not specified, the test source must be passed as the second argument to the test runner. src_folders: ["Scenarios"], // See https://nightwatchjs.org/guide/working-with-page-objects/ page_objects_path: "pages", // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands custom_commands_path: ["./custom_commands", "node_modules/nightwatch-custom-commands-assertions/js/commands", "node_modules/nightwatch-helpers/commands", "./node_modules/nightwatch-xhr/es5/commands", "./node_modules/nightwatch-mixpanel/es5/commands", "./node_modules/nightwatch-vrt/commands"], // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-assertions custom_assertions_path: ["./custom_assertions", "node_modules/nightwatch-custom-commands-assertions/js/assertions", "node_modules/nightwatch-helpers/assertions", "./node_modules/nightwatch-xhr/es5/assertions", "./node_modules/nightwatch-mixpanel/es5/assertions", "node_modules/nightwatch-vrt/assertions"], // See https://nightwatchjs.org/guide/#external-globals globals_path: "./globals.js", data_path: "data", output_folder: REPORTS, // The location where the JUnit XML report files will be saved. live_output: false, // Whether or not to buffer the output in case of parallel running webdriver: { "keep_alive": true }, test_settings: { default: { disable_error_log: false, launch_url: "http://localhost", silent: true, use_xpath: false, test_workers: { "enabled": true, "workers": 20 }, globals: require('./globals'), screenshots: { enabled: true, path: FAILURES_ERRORS_PATH, on_failure: true }, desiredCapabilities: { browserName: 'chrome', javascriptEnabled: true, acceptSslCerts: true, }, end_session_on_fail: true, // End the session automatically when the test is being terminated, usually after a failed assertion. skip_testcases_on_fail: true, // Skip the remaining testcases (or test steps) from the same test suite (i.e. test file), when one testcase fails. detailed_output: true, // By default detailed assertion output is displayed while the test is running. Set this to `false` if you'd like to only see the test case name displayed and pass/fail status. This is especially useful when running tests in parallel. webdriver: { start_process: true, server_path: (Services.chromedriver ? Services.chromedriver.path : '') }, browserTag: "mttestcr" }, l_firefox: { desiredCapabilities: { browserName: 'firefox', alwaysMatch: { acceptInsecureCerts: true, 'moz:firefoxOptions': { args: [ // '-headless', // '-verbose' ] } } }, webdriver: { start_process: true, port: 4444, server_path: (Services.geckodriver ? Services.geckodriver.path : ''), cli_args: [ // very verbose geckodriver logs // '-vv' ] }, browserTag: "mttestff" }, h_firefox: { desiredCapabilities: { browserName: 'firefox', alwaysMatch: { acceptInsecureCerts: true, 'moz:firefoxOptions': { args: [ '-headless', // '-verbose' ] } } }, webdriver: { start_process: true, port: 4444, server_path: (Services.geckodriver ? Services.geckodriver.path : ''), cli_args: [ // very verbose geckodriver logs // '-vv' ] }, browserTag: "mttestff" }, l_chrome: { desiredCapabilities: { browserName: 'chrome', loggingPrefs: { browser: "ALL" }, javascriptEnabled: true, acceptSslCerts: true, 'goog:chromeOptions': { // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/ // // This tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78) w3c: false, args: [ '--no-sandbox', //'--ignore-certificate-errors', //'--allow-insecure-localhost', //'--headless' ], prefs: { "profile.default_content_setting_values.cookies": 1, // Allow sites to save and read cookie data (recommended): 2=Blocked, 1=Allow }, } }, webdriver: { start_process: true, port: 9515, server_path: (Services.chromedriver ? Services.chromedriver.path : ''), cli_args: [ // --verbose ] }, browserTag: "mttestcr" }, h_chrome: { desiredCapabilities: { browserName: 'chrome', loggingPrefs: { browser: "ALL" }, javascriptEnabled: true, acceptSslCerts: true, 'goog:chromeOptions': { // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/ // // This tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78) w3c: false, args: [ '--no-sandbox', //'--ignore-certificate-errors', //'--allow-insecure-localhost', '--headless', '--window-size=1920,925', '--log-level=3', '--disable-gpu', '--disable-software-rasterizer', ], prefs: { "profile.default_content_setting_values.cookies": 1, // Allow sites to save and read cookie data (recommended): 2=Blocked, 1=Allow }, } }, webdriver: { start_process: true, port: 9515, server_path: (Services.chromedriver ? Services.chromedriver.path : ''), cli_args: [ // --verbose ] }, browserTag: "mttestcr" }, l_edge: { desiredCapabilities: { browserName: 'MicrosoftEdge', 'ms:edgeOptions': { w3c: false, // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options args: [ //'--headless' ] } }, webdriver: { start_process: true, // Download msedgedriver from https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/ // and set the location below: server_path: "C:\\Windows\\System32\\msedgedriver.exe", cli_args: [ // --verbose ] }, browserTag: "mtteste" }, h_edge: { desiredCapabilities: { browserName: 'MicrosoftEdge', 'ms:edgeOptions': { w3c: false, // More info on EdgeDriver: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options args: [ '--no-sandbox', //'--ignore-certificate-errors', //'--allow-insecure-localhost', '--headless', '--window-size=1920,925', '--log-level=3', '--disable-gpu', '--disable-software-rasterizer', ] } }, webdriver: { start_process: true, // Download msedgedriver from https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/ // and set the location below: server_path: "C:\\Windows\\System32\\msedgedriver.exe", cli_args: [ // --verbose ] }, browserTag: "mtteste" }, ////////////////////////////////////////////////////////////////////////////////// // Configuration for when using the browserstack.com cloud service | // | // Please set the username and access key by setting the environment variables: | // - BROWSERSTACK_USER | // - BROWSERSTACK_KEY | // .env files are supported | ////////////////////////////////////////////////////////////////////////////////// browserstack: { selenium: { host: 'hub-cloud.browserstack.com', port: 443 }, // More info on configuring capabilities can be found on: // https://www.browserstack.com/automate/capabilities?tag=selenium-4 desiredCapabilities: { 'bstack:options': { userName: '${BROWSERSTACK_USER}', accessKey: '${BROWSERSTACK_KEY}', } }, disable_error_log: true, webdriver: { timeout_options: { timeout: 15000, retry_attempts: 3 }, keep_alive: true, start_process: false } }, 'browserstack.local': { extends: 'browserstack', desiredCapabilities: { 'browserstack.local': true } }, 'browserstack.chrome': { extends: 'browserstack', desiredCapabilities: { browserName: 'chrome', chromeOptions: { w3c: false } } }, 'browserstack.firefox': { extends: 'browserstack', desiredCapabilities: { browserName: 'firefox' } }, 'browserstack.ie': { extends: 'browserstack', desiredCapabilities: { browserName: 'internet explorer', browserVersion: '11.0' } }, 'browserstack.safari': { extends: 'browserstack', desiredCapabilities: { browserName: 'safari' } }, 'browserstack.local_chrome': { extends: 'browserstack.local', desiredCapabilities: { browserName: 'chrome' } }, 'browserstack.local_firefox': { extends: 'browserstack.local', desiredCapabilities: { browserName: 'firefox' } }, ////////////////////////////////////////////////////////////////////////////////// // Configuration for when using the Selenium service, either locally or remote, | // like Selenium Grid | ////////////////////////////////////////////////////////////////////////////////// selenium_server: { // Selenium Server is running locally and is managed by Nightwatch selenium: { start_process: false, host: '127.0.0.1', port: 4444, launch_url: 'http://localhost', server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''), cli_args: { 'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''), 'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : '') } } }, 'selenium.chrome': { extends: 'selenium_server', desiredCapabilities: { browserName: 'chrome', chromeOptions: { w3c: false, args: [ '--no-sandbox', '--ignore-certificate-errors', '--allow-insecure-localhost', '--headless', '--disable-gpu', '--disable-software-rasterizer', //'--verbose', '--window-size=1920,925', '--log-level=3' ] } } }, 'selenium.firefox': { extends: 'selenium_server', desiredCapabilities: { browserName: 'firefox', 'moz:firefoxOptions': { args: [ // '-headless', // '-verbose' ] } } } } }; function loadServices() { try { Services.seleniumServer = require('selenium-server'); } catch (err) { } try { Services.chromedriver = require('chromedriver'); } catch (err) { } try { Services.geckodriver = require('geckodriver'); } catch (err) { } } ```
Your Environment
nightwatch --version
npm --version
yarn --version
node --version