-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
latest
Node.js Version
latest
Mode
WDIO Testrunner
Which capabilities are you using?
{
"browserName": "chrome",
"goog:javascriptEnabled": true,
"goog:chromeOptions": {
"args": [
"--no-sandbox",
"--disable-dev-shm-usage",
"--window-size=1600,900",
"--allow-insecure-localhost",
"--disable-web-security",
"--enable-automation",
"--safebrowsing-disable-download-protection",
"--remote-allow-origins=*",
"--disable-gpu",
"--no-first-run"
],
"prefs": {
"acceptInsecureCerts": true,
"directory_upgrade": true,
"prompt_for_download": false,
"safebrowsing.enabled": true,
"download.default_directory": "downloadDir"
}
}
}What happened?
When WebDriverIO attempts to determine the version of Chrome installed on the local machine, it invokes the --version command. This command yields the result: ‘Google Chrome 116.0.5845.110 \n’.
The issue arises in this line:
https://github.com/webdriverio/webdriverio/blob/24d8f0dccf54e6e19779094d73eb90ae9086ee86/packages/wdio-utils/src/driver/utils.ts#L61C5-L61C5
Here, the code tries to split the version string by whitespace and retrieve the last token. However, the actual last token is the newline character (\n), not the Chrome version. This causes WebDriverIO to bypass the local Chrome installation and default to downloading Chromium.
Proposed Solution:
To remedy this, we could first use a regex to eliminate the \n character from the string. Then, apply a trim() method to ensure no leading or trailing whitespaces. Following that, the current split-and-retrieve command can be executed.
What is your expected behavior?
WebDriverIO will correctly parse the output of the --version command for Chrome.
How to reproduce the bug.
Nothing special, just create a project using a wdio command, set a capability without setting a browserVersion and run the example test.
Relevant log output
Nothing relevantCode of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
