Skip to content

[🐛 Bug]: Error fetching Chrome version on headless Chromium in @wdio/utils  #11113

@longfeiwAmazonDE

Description

@longfeiwAmazonDE

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.15.10

Node.js Version

v18.x

Mode

WDIO Testrunner

Which capabilities are you using?

{
    browserName: "chrome",
    goog:chromeOptions: {
        binary: "path/to/executable/chromium/headless_shell"
    }
}

What happened?

When using webdriverio v8.15.10 with a headless Chromium browser, the @wdio/utils package attempts to fetch the Chrome version using the command cp.execSync("${chromePath}" --version").toString(). However, this command fails when running headless Chromium, resulting in the following error:

Error: Command failed: "/tmp/chromium/chromium" --version.

We also tried Chromium@118 provided from @puppeteer/browsers and the same error occurred.

What is your expected behavior?

Be able to talk to the browser.

How to reproduce the bug.

  1. Set up a project with webdriverio v8.15.10
  2. Configure the project to use a headless Chromium browser
  3. Run a test

Relevant log output

Execution of 1 workers started at 2023-09-07T08:48:46.773Z
2023-09-07T08:48:49.861Z INFO @wdio/utils: Setting up browser driver for: chrome@stable
2023-09-07T08:48:49.946Z INFO @wdio/utils: Setting up browser binaries for: chrome@stable
[0907/084849.963224:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
2023-09-07T08:48:49.965Z INFO @wdio/local-runner: Shutting down spawned worker
2023-09-07T08:48:50.216Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2023-09-07T08:48:50.217Z INFO @wdio/local-runner: shutting down
"Error: Error: Command failed: ""/tmp/chromium/chromium"" --version"
[0907/084849.963224:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
    at checkExecSyncError (node:child_process:885:11)
    at Object.execSync (node:child_process:957:15)
    at getBuildIdByChromePath (file:/path_to/node_modules/@wdio/utils/build/driver/utils.js:41:30)
    at setupPuppeteerBrowser (file:/path_to/node_modules/@wdio/utils/build/driver/utils.js:86:19)
    at async Promise.all (index 0)
    at async Promise.all (index 1)
    at async Launcher.run (file://path_to/node_modules/@wdio/cli/build/launcher.js:98:13)

Code 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions