[wdio-devtools-service] Support CDP on Selenium 4 Grid
See original GitHub issueIs 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: https://github.com/webdriverio/webdriverio/blob/26772cdb71d211c0f63fc5b6247fe41c5f83ba76/packages/webdriverio/src/commands/browser/getPuppeteer.ts#L58
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
- User provided a custom debuggerAddress
- Whether a local run or a remote host/port is being used
- 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)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (12 by maintainers)
Sounds good to me!
@christian-bromann @BorisOsipov Good point! I agree, it will be better to use default Selenium-like ws endpoints. I will create issues for the Selenoid team.