Skip to content

[wdio-devtools-service] Support CDP on Selenium 4 Grid #6470

@dylanlive

Description

@dylanlive

Is your feature request related to a problem? Please describe.
Selenium 4.0 (now in Beta) supports proxying CDP Requests across Grid.

It would be nice if we could use the WebdriverIO Devtools Service to run those commands against a Selenium 4.0 Grid.

Describe the solution you'd like
When providing a remote machine in the config, such as:

    runner: 'local',
    hostname: 'my.grid.ip',
    port: 4444,

And providing the devtools service

services: ['devtools'],

I should be able to call commands in my test like:

browser.cdp('Browser', 'getVersion')

Describe alternatives you've considered
n/a

Additional context
I'm happy to take a shot at this PR if you'd accept it. I believe the change will occur in here:

browserURL: `http://${chromiumOptions.debuggerAddress}`

         this.puppeteer = await puppeteer.connect({
-            browserURL: `http://${chromiumOptions.debuggerAddress}`,
+            browserWSEndpoint: `ws://${this.config.hostname}:${this.config.port}/session/${this.sessionId}/se/cdp`,
         })

Of course with some conditionals added depending on if

  1. User provided a custom debuggerAddress
  2. Whether a local run or a remote host/port is being used
  3. If it's Remote, check if it's a Selenium 4.0 Grid that accepts those commands (can probably look at returned capabilities, which exposes this endpoint)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions