Skip to content

[🐛 Bug]: SeleniumServer.start() crashes on MacOS with nodejs selenium-webdriver #12076

@bswhb

Description

@bswhb

What happened?

The jar file selenium-server-4.9.jar is placed in MacOS userdata which is /Users/<username>/Library/Application Support/<appname>/selenium-server/4.9.0/selenium-server.jar, as we can see, there's a space in the path.

The space will break the ChildProcess.execSync function which is used to detect the version of the jar file.

We suggest to change the following execSync function with execFileSync in selenium-webdriver/remote/util.js:

  // const execRes = cp.execSync(
  //   `${javaPath} -jar ${seleniumStandalonePath} --version`
  // )
  const execRes = cp.execFileSync(javaPath, ['-jar', seleniumStandalonePath, '--version'])

How can we reproduce the issue?

  const seleniumPort = await detect(4852)
  logger.info(`Starting up webdriver server on port ${seleniumPort}...`)
  seleniumServer = new SeleniumServer(
    join(userdataPath, 'selenium-server', package.dependencies['selenium-server'], 'selenium-server.jar'), {
      jvmArgs: [
        '-Dwebdriver.server.session.timeout=86400'
      ],
      port: seleniumPort
    })
  await seleniumServer.start()

Relevant log output

Error: Command failed: /Users/<username>/Library/Application Support/<appname>/openjdk/1.8.0/bin/java -jar /Users/<username>/Library/Application Support/<appname>/selenium-server/4.9.0/selenium-server.jar --version
/bin/sh: /Users/<username>/Library/Application: No such file or directory


### Operating System

MacOS Big Sur 11.7.6

### Selenium version

4.9.0

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

N/A

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

N/A

### Are you using Selenium Grid?

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-nodejsJavaScript BindingsI-defectSomething is not working as intendedJ-awaiting answerQuestion asked of user; a reply moves it to triage again

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions