Description
Summary
When using the command line interface, the --javaArgs
argument value gets interpreted as a string and expanded to an array containing each character in the string. For example, in the case of --javaArgs=-Dfoobar
, the "-Dfoobar" gets expanded to ['-', 'D', 'f', 'o', 'o', 'b,' 'a', 'r']
.
This is where the expansion occurs:
selenium-standalone/lib/start.js
Line 145 in 0c4041c
This is fine when using the API directly, because opts.javaArgs
is expected to be an array. However, the parsing logic for the CLI doesn't appear to take this into account.
Expected Behavior
The --javaArgs
argument value should be correctly parsed and passed through to selenium-server.
Current Behavior
Each character in the --javaArgs
argument value is passed as a separate argument to selenium-server.
Steps to Reproduce
npm install selenium-standalone -g
selenium-standalone install
selenium-standalone start --javaArgs=-Xmx512m
Logs
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
/home/currentuser/.nvm/versions/node/v16.17.1/lib/node_modules/selenium-standalone/lib/check-started.js:44
throw new Error(
^
Error: Selenium exited before it could start with code 1
Stdout:
Stderr:
at checkStarted (/home/currentuser/.nvm/versions/node/v16.17.1/lib/node_modules/selenium-standalone/lib/check-started.js:44:13)
at async Object.start (/home/currentuser/.nvm/versions/node/v16.17.1/lib/node_modules/selenium-standalone/lib/start.js:160:3)
at async Object.start (/home/currentuser/.nvm/versions/node/v16.17.1/lib/node_modules/selenium-standalone/bin/selenium-standalone:23:16)
Your Environment
- Version of
selenium-standalone
that you are using: 8.2.4 - Is there another tool calling
selenium-standalone
on your behalf: No - System/platform: Ubuntu 22.04.1 LTS
- Other details that might be important:
This bug was encountered in Update selenium dependency versions dotnet/aspnetcore#44834