Support Selenium 4.0 Grid CDP for Devtools Service#6508
Support Selenium 4.0 Grid CDP for Devtools Service#6508christian-bromann merged 3 commits intowebdriverio:mainfrom
Conversation
|
Not seeing where to sign the CLA in any of the contributor docs. |
|
| const cdpEndpoint = caps['se:options']?.cdp | ||
| if (cdpEndpoint) { | ||
| this.puppeteer = await puppeteer.connect({ | ||
| browserWSEndpoint: cdpEndpoint |
There was a problem hiding this comment.
If we make some hardcoded assumptions here, this could work with the docker images as described in #6470 (comment)
Something like:
ws://${this.config.hostname}:${this.config.port}/session/${this.sessionId}/se/cdp
Definitely not as slick though and more likely to break in a future update. Would be a temp bandaid until SeleniumHQ/selenium#9202 is addressed.
christian-bromann
left a comment
There was a problem hiding this comment.
One comment but otherwise this looks good to me. Do you mind signing the CLA?
| * Selenium 4.0 Specific | ||
| */ | ||
| 'se:options'?: { | ||
| cdp?: string; |
There was a problem hiding this comment.
Do we know more Selenium specific options we can add within this PR?
There was a problem hiding this comment.
Not to my knowledge
|
Will get the CLA signed as soon as I'm able to |
|
@dylanlive awesome! It would be also great if you could update your branch as I tweaked the pipline a bit. Thanks! |
|
@dylanlive any chance to update the branch and sign the CLA? Would love to get this into the next |
Selenium 4 (beta-1) Grid supports CDP Websocket Requests, and returns the endpoint in the returned capabilities under {"se:options": { "cdp": "the_url" }}. This commit will utilize that endpoint (if returned in the capabilities) as the Puppeteer Websocket Endpoint.
|
@christian-bromann CLA signed, thanks for your patience. Merged in the latest changes and applied the defaultViewport from #6487 Did a few quick tests as well with a Se4 Grid (confirmed working) and a Se3 Grid (confirmed not working, as expected). As a suggestion, if you could add a link to the CLA in https://github.com/webdriverio/webdriverio/blob/main/CONTRIBUTING.md, I think that could have sped up the process in my case. |
Good idea, will make that change. Thanks for the contribution! |
|
I have a problem with debuggerAddress, cause I am using https instead of http. How to fix it? |
|
Why are you using https for a local Selenium server? |
Proposed changes
Addresses #6470. This PR allows using the devtools service with Selenium 4.0 Grid (beta-1).
When creating a new session, Selenium 4.0 Beta 1 will respond with an endpoint that can be used to make direct websocket requests with (see below for example response).
Puppeteer takes that as
browserWSEndpointas described here.Types of changes
Checklist
Further comments
I have read discussions that potentially in a future Se4 Beta, the structure of
"se:options"may change. However, I figured we can at least get the ball rolling now and make tweaks as needed.The conditional precedence is very important in this PR. A response can have both
se:optionsand thedebuggerAddressthat gets tacked on by Chromedriver.Full response example here:
ws://${this.config.hostname}:${this.config.port}/session/${this.sessionId}/se/cdp, which works) instead of utilizing what is returned by Selenium.Reviewers: @webdriverio/project-committers