Skip to content

[💡 Feature]: disable automatic driver setup when using devtools automation protocol #11129

@marcogrcr

Description

@marcogrcr

Is your feature request related to a problem?

Version 8.14 introduced automatic web driver configuration. While this is great, it can be an annoyance when using the devtools automation protocol. My tests run in a network environment with limited access to the Internet and they fail because of this. While this can be disabled (#11128), it's counterintuitive to specify a port or a driver binary to disable the download despite it will never be used.

Describe the solution you'd like.

At first glance, it should be as simple as wrapping this:

/**
* pre-configure necessary driver for worker threads
*/
await Promise.all([
setupDriver(config, caps),
setupBrowser(config, caps)
])

with an if statement as follows:

if (config.automationProtocol !== 'webdriver') {
    await Promise.all([
        setupDriver(config, caps),
        setupBrowser(config, caps)
    ])
}

However, this wouldn't work with configurations where multiple automation protocols are used, for example:

export const config: WebdriverIO.Config = {
  beforeSession(config, capabilities) {
    if (capabilities.browserName === 'chrome') {
      config.automationProtocol = 'devtools'
    } else {
      config.automationProtocol = 'webdriver'
    }
  }
  // ...
}

Thus, in order for this to work, the setup*() method invocations must be moved after the onWorkerStart and before the actual runner is started (e.g. line 437 below):

// run worker hook to allow modify runtime and capabilities of a specific worker
log.info('Run onWorkerStart hook')
await runLauncherHook(config.onWorkerStart, runnerId, caps, specs, this._args, execArgv)
.catch((error) => this._workerHookError(error))
await runServiceHook(this._launcher!, 'onWorkerStart', runnerId, caps, specs, this._args, execArgv)
.catch((error) => this._workerHookError(error))
// prefer launcher settings in capabilities over general launcher
const worker = await this.runner.run({

Describe alternatives you've considered.

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Idea 💡A new feature ideaNeeds Triaging ⏳No one has looked into the issue yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions