Skip to content

[🐛 Bug]: Error when using different node versions #10970

@TamsilAmani

Description

@TamsilAmani

What happened?

Issue 1 is based on nightwatchjs/nightwatch#3337

ISSUE 1:
On node v10 (10.24.1), when I run the selenium code, I get the error SyntaxError: Unexpected token = in file virtual_authenticator.js. The same script runs without any error in v12 (12.22.12).
I am not able to test it on v11.

ISSUE 2:
There is another issue which occurs in the same selenium code. On node v18 (18.7.0) the code is not able to start geckodriver and it gives the error Error: Timed out waiting for the WebDriver server at http://localhost:51846/. The same code works without any error (i.e. it starts the geckodriver) in v16 (16.16.0)

This looks like some version problem with nodejs. I'm troubleshooting it from my end. Any leads would be helpful.
CC: @harsha509

How can we reproduce the issue?

Step 1: Set your nodejs version with your version manager. I use nvm.
Step 2: Run the following selenium code.

const {Builder} = require('selenium-webdriver');

(async function helloSelenium() {
    let driver = await new Builder().forBrowser('firefox').build();

    await driver.get('https://selenium.dev');

    await driver.quit();
})();

Relevant log output

ISSUE 1:

/Users/tamsilamani/Desktop/BrowserStack/seleniumhq.github.io/examples/javascript/node_modules/selenium-webdriver/lib/virtual_authenticator.js:26
  Protocol = {
           ^

SyntaxError: Unexpected token =
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/tamsilamani/Desktop/BrowserStack/seleniumhq.github.io/examples/javascript/node_modules/selenium-webdriver/lib/webdriver.js:40:20)



ISSUE 2:

/Users/tamsilamani/Desktop/BrowserStack/seleniumhq.github.io/examples/javascript/node_modules/selenium-webdriver/http/util.js:88
        reject(Error('Timed out waiting for the WebDriver server at ' + url))
               ^

Error: Timed out waiting for the WebDriver server at http://localhost:51846/
    at onError (/Users/tamsilamani/Desktop/BrowserStack/seleniumhq.github.io/examples/javascript/node_modules/selenium-webdriver/http/util.js:88:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Operating System

macOS Monterey

Selenium version

Javascript 4.4.0

What are the browser(s) and version(s) where you see this issue?

Firefox 103.0.2

What are the browser driver(s) and version(s) where you see this issue?

GeckoDriver 0.31.0

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

Labels

C-nodejsJavaScript BindingsI-defectSomething is not working as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions