selenoid
selenoid copied to clipboard
Add Selenium-like websocket endpoint for CDP proxy
Starting from 4.06a Selenium supports CDP proxy and allows connecting websocket to ws://hub:port/session/${sessionId}/se/cdp
.
It would be great to have the same interface for Selenoid in addition/instead of existed ws://selenoid.example.com:4444/devtools/<session-id>/<method>
. The unified interface simplifies writing client libraries.
@L0tso client libraries usually have ws://
URL as constructor parameter. Don't get how renaming our API would simplify things.
@vania-pooh Not all client libraries ready to give full control for client. Libraries which use default Selenium 4 endpoint, will automatically work with Selenoid. These issues based on this issue https://github.com/webdriverio/webdriverio/issues/6470
Actually the way webdriverio
uses is not reliable. selenoid
doesn't provide a way for the client to know it is using selenoid
or other tools. IMHO it would be better for selenoid
to declare those extra endpoints in the session create response, for example:
{
"value": {
"capabilities": {
"acceptInsecureCerts": false,
"browserName": "msedge",
"browserVersion": "102.0.1245.33",
"ms:edgeOptions": {
"debuggerAddress": "localhost:58305"
},
"msedge": {
"msedgedriverVersion": "102.0.1245.30 (8f49f1a4740db8559bf9e49b4a7b6c754f80250d)",
"userDataDir": "C:\\cygwin64\\tmp\\scoped_dir25608_311506428"
},
"networkConnectionEnabled": false,
"pageLoadStrategy": "normal",
"platformName": "windows",
"proxy": {},
"setWindowRect": true,
"strictFileInteractability": false,
"timeouts": {
"implicit": 0,
"pageLoad": 300000,
"script": 30000
},
"unhandledPromptBehavior": "dismiss and notify",
"webauthn:extension:credBlob": true,
"webauthn:extension:largeBlob": true,
"webauthn:virtualAuthenticators": true,
"selenoid:endpoints": {
"cdp": "ws://selenoid.example.com:4444/devtools/f3cb3a08eb481980ed0b53cd446e6b84/",
"vnc": "ws://selenoid.example.com:4444/vnc/f3cb3a08eb481980ed0b53cd446e6b84/",
"download": "http://selenoid.example.com:4444/download/f3cb3a08eb481980ed0b53cd446e6b84/"
}
},
"sessionId": "f3cb3a08eb481980ed0b53cd446e6b84"
}
}
So that the client can just check the response to know what resource it can use instead of guessing.
@link89 you can't pass session_id
in capabilities because it only known when session is created.
@vania-pooh session-id is already in the response of session create request. I guess you were confused with the request's capabilities.
And back to the original question, I don't think it need to change the url of cdp, but just add "se:cdp": "ws://selenoid.example.com:4444/devtools/f3cb3a08eb481980ed0b53cd446e6b84/"
to the response, that's enough.
Let's do this.