axe-core-npm
axe-core-npm copied to clipboard
Unable to set window-size on --chrome-options argument on CLI
Product: CLI
Expectation: any options added to the --chrome-options
argument should be passed down to the ChromeDriver
Actual: options that require a comma on its value (like window-size=1920,1080
) causes ChromeDriver to fail initializing
Motivation: sometimes users might want to specify the window size to run tests on specific viewports
axe-core version: 4.4.1
@axe-core/cli: 4.4.3 (on fcfa36c2)
- Node version: v14.19.0
- Platform: Linux
This happens because the CLI is using a comma or a semicolon to split different options:
https://github.com/dequelabs/axe-core-npm/blob/fcfa37c24a3a9e0122d152ecf85d597e9ebd5c31/packages/cli/src/lib/utils.ts#L112-L114
This way, options which require a comma on its value are passed down as two options instead of one: window-size=1920
and 1080
(note both arg:
logs on the console)
If I change the RegExp to /[;]/
instead, everything works fine:
However, this would introduce a breaking change, so I'm unsure how to proceed. To be more generic and avoid future problems, we could add a --delimiter-character
argument and use that to split lists on the CLI (and have /[,;]/
as a fallback). Or we could have a --chrome-options-delimiter-character
argument, only changing the split behavior regarding the --chrome-options
argument.
I'm happy to open a PR if we're able to agree on how to solve this.
Hey @renato-bohler, we are currently looking into this issue.
This is still an issue for me too. Is there any workaround currently?
This is still an issue for me too. Is there any workaround currently?
The only way I could workaround this was by patching the CLI after installing it globally on the Docker container, to use only the semicolon as a separator.
Hey 👋
We are looking into options on how to do this. We are unable to change the regex from /[,;]/
to /[;]/
due to cascading effects for example when trying to set multiple chrome options --chrome-options="--window-size=1920,1080, --disable-dev-shm-usage
would not work correctly due to it being a single array value within config as well as changing the functionality of splitList
since it is not just being used with chrome options but multiple other flags.