Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Selenium-like websocket endpoint for CDP proxy #1063

Closed
L0tso opened this issue Feb 19, 2021 · 7 comments · Fixed by #1354
Closed

Add Selenium-like websocket endpoint for CDP proxy #1063

L0tso opened this issue Feb 19, 2021 · 7 comments · Fixed by #1354
Milestone

Comments

@L0tso
Copy link

L0tso commented Feb 19, 2021

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.

@vania-pooh
Copy link
Member

@L0tso client libraries usually have ws:// URL as constructor parameter. Don't get how renaming our API would simplify things.

@L0tso
Copy link
Author

L0tso commented Feb 19, 2021

@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 webdriverio/webdriverio#6470

@link89
Copy link

link89 commented Jun 9, 2022

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.

@vania-pooh
Copy link
Member

@link89 you can't pass session_id in capabilities because it only known when session is created.

@link89
Copy link

link89 commented Jun 9, 2022

@vania-pooh session-id is already in the response of session create request. I guess you were confused with the request's capabilities.

@link89
Copy link

link89 commented Jun 10, 2022

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.

@vania-pooh
Copy link
Member

Let's do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants