Open lunayui opened 4 years ago
Hi @lunayui, can you share the capabilities used for the test, while retracting your credentials.
I suspect that a JSONWire Protocol endpoint '/execute' was sent to what appears to a session using the newer W3C Webdriver Protocol, which expects the endpoint '/execute/sync' causing the error.
JSONWire Protocol: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidexecute W3C Webdriver Protocol: https://www.w3.org/TR/webdriver/#execute-script
this is my nightwatch_config
nightwatch_config = { src_folders: [source_path], selenium: { start_process: false, host: 'hub-cloud.browserstack.com', port: 443 }, globals_path: 'globals.js', custom_commands_path: [ 'node_modules/nightwatch-coverage/commands' ], test_settings: { default: { // Used for the aynchronous browser.perform command // 30 minutes globals: { asyncHookTimeout: 1800000 }, request_timeout_options: { timeout: 600000 }, desiredCapabilities: { project: BROWSERSTACK_PROJECT, build: BROWSERSTACK_BUILD, 'browserstack.user': XXXXXX, 'browserstack.key': XXXXXX, 'browserstack.local': true, 'browserstack.networkLogs': false, 'browserstack.localIdentifier': BROWSERSTACK_BUILD, browser: 'chrome', browser_version: '83.0', // The latest version of chrome os: 'Windows', os_version: '10', resolution: '2048x1536' // maximum resolution supported on browserstack. } } } }; // Code to copy seleniumhost/port into test settings for (var i in nightwatch_config.test_settings) { var config = nightwatch_config.test_settings[i]; config['selenium_host'] = nightwatch_config.selenium.host; config['selenium_port'] = nightwatch_config.selenium.port; config['desiredCapabilities'] = config['desiredCapabilities'] || {}; }
module.exports = nightwatch_config;
Hello, could you please try executing a test with Nightwatch v.1.3.4 and share the output? I executed a sample test and the command ".execute("document.readyState")"worked fine. Sample session: https://automate.browserstack.com/builds/fbb7c6463835662567d5feb4cd5215db4d26fbf7/sessions/354d6e134ef82a503bdf1342c1b8354043b23f6a?auth_token=20643b00980d140fa4175dab201dc56cf1ae46ba6d14fb7ef824cc9362d2af8e
Hello, I update Nightwatch v.1.3.4 and the latest but the error was change for :
[0;36m[Run All] Test Suite[0m
10:46:27 [0;35m====================[0m
10:46:27 - [0;36mConnecting to hub-cloud.browserstack.com on port 443...
10:46:27 [0m
10:46:27 Connecting to BrowserStack Local...
10:46:27 ⚠ [0;31mError connecting to hub-cloud.browserstack.com on port 443.[0m
10:46:27 Nigthwach Browser Nightwatch API
10:46:27 [1;31m Response 500 POST https://hub-cloud.browserstack.com/wd/hub/execute (161ms)[0m
10:46:27 { value: { message: [32m'Invalid Command'[39m, error: [] } }
10:46:27 [1;31mError while running .executeScript() protocol action: Invalid Command
10:46:27 [0m
10:46:27 { status: -1,
10:46:27 state: '',
10:46:27 value: { message: 'Invalid Command', error: [] },
10:46:27 errorStatus: '',
10:46:27 error: 'Invalid Command',
10:46:27 httpStatusCode: 500 }
10:46:27 [1;31m[0;31m Error: Error while running "execute" command: An error occurred while gathering coverage information[0m
10:46:27 [0;90m at <anonymous>[0m[0m
10:46:27
10:46:27 See more info, video, & screenshots on Browserstack:
10:46:27 [1;36mhttps://automate.browserstack.com/builds/undefined/sessions/undefined[0m
10:46:27 [1;31m_________________________________________________[0m
10:46:27
10:46:27 [1;31mTEST FAILURE:[0m [0;31m2[0m errors during execution; [0;31m0[0m tests failed, [0;32m0[0m passed [0;90m(1.259s)[0m
10:46:27
10:46:27 [0;31m ✖ runAll[0m
10:46:27 [0;31mError while running "execute" command: An error occurred while gathering coverage information[0m
10:46:27 [0;90mError: Error while running "execute" command: An error occurred while gathering coverage information
10:46:27 at <anonymous>[0m
10:46:27
10:46:27 [0;31m Error: An error occurred while retrieving a new session: "[browserstack.local] is set to true but local testing through BrowserStack is not connected."[0m
10:46:27 [0;90m at endReadableNT (_stream_readable.js:1064:12)
10:46:27 at _combinedTickCallback (internal/process/next_tick.js:139:11)[0m
10:46:27
10:46:27
10:46:27 [0;31m Error: Error while running "execute" command: An error occurred while gathering coverage information[0m
10:46:27 [0;90m at <anonymous>[0m
Hey @lunayui
I have reached out to you over email for further steps to get this working.
Hi @shawnlobo96 I am stuck with a similar issue. Can you pls help me with the further steps too? Thanks!
Hello, Thank you for reaching out to us. We are working on your issue -706829 and will get back to you soon with an update. Please let us know if you have any more questions, we will be happy to help. Regards, Utkarsh Sharma BrowserStack Support BrowserStack Docs BrowserStack FAQs
On
Fri, 8 Jul at 9:10 AM
, browserstack/nightwatch-browserstack ***@***.***> wrote:
Hi @shawnlobo96 I am stuck with a similar issue. Can you pls help me with the further steps too? Thanks!
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
I'm starting the BrowserStackLocal process via local.runner.js. and Nightwatch coverage code
But the build-in Jenkins is still failing and shows the error :
Response 500 POST https://hub-cloud.browserstack.com/wd/hub/execute (163ms) { value: { message: 'Invalid Command', error: [] } } Error while running .executeScript() protocol action: Invalid Command { status: -1, state: '', value: { message: 'Invalid Command', error: [] }, errorStatus: '', error: 'Invalid Command', httpStatusCode: 500 } Error: Error while running "execute" command: An error occurred while gathering coverage information at
at process._tickCallback (internal/process/next_tick.js:189:7)
nightwatch.conf.js
globals_path: path.resolve(constants.NIGHTWATCH_CONFIGS_PATH, 'globals.js'), custom_commands_path: [ 'node_modules/nightwatch-coverage/commands' ],
global.js `const path = require('path'); const { createCoverageReporter } = require('nightwatch-coverage');
const coverageReporter = createCoverageReporter({ coverageDirectory: path.join(process.cwd(), 'tests/colosseum/coverage'), });
module.exports = {
coverageReporter, abortOnAssertionFailure: true, waitForConditionPollInterval: 500, waitForConditionTimeout: 5000,
// executed after every test suite has ended afterEach(browser,done) { console.log("Nigthwach Browser " + browser.collectCoverage()); browser.collectCoverage(function () { client.end(done); }); },
//executed after the test run has finished
after(done) { console.log("coverage report "+coverageReporter); coverageReporter.save(); done(); } }`