question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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: 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

  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)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
christian-bromanncommented, Feb 20, 2021

Thoughts on that side? Maybe I could just take the step for Selenium now, and then we can revisit once aerokube/selenoid#1063 is implemented?

Sounds good to me!

1reaction
L0tsocommented, Feb 18, 2021

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@wdio/devtools-service - npm
Start using @wdio/devtools-service in your project by running `npm i ... only works when running tests locally or through a Selenium Grid v4...
Read more >
How To Use Chrome DevTools Protocol (CDP) In Selenium 4
Are you aware of the “Pin Script” feature in Selenium 4 ? If not, then this video is for you as it gives...
Read more >
Selenium Chrome DevTools Protocol (CDP) API - Applitools
Selenium 4 introduces a new powerful API which grants access to Chrome DevTools directly from your automated tests!
Read more >
selenium chrome devtools - ViviMinervino
With Selenium 4 How To Use Chrome DevTools Protocol (CDP) In Selenium 4 JAVA This video ... Selenium 4 has added native support...
Read more >
Selenium 4.x trying to POST CDP - Stack Overflow
For selenium -grid I see ws:// cdp url returned, I think it means that selenium-grid doesn't support cdp command end-points and delegates cdp...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found