Skip to content

[Bug]: CDP url doesn't work for url with parameter #36097

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

Closed
zzxwill opened this issue May 27, 2025 · 0 comments · Fixed by #36098
Closed

[Bug]: CDP url doesn't work for url with parameter #36097

zzxwill opened this issue May 27, 2025 · 0 comments · Fixed by #36098

Comments

@zzxwill
Copy link
Contributor

zzxwill commented May 27, 2025

Version

1.50.0

Steps to reproduce

Use playwright to call a CDP

cdp_url = "https://xxx.apigateway-cn-beijing.volceapi.com/v0.1/browsers/22afeb33-8786-46c7-b2f5-0dd63c9782a5/?faasInstanceName=abc"

Expected behavior

It should direct to url like https://xxx.apigateway-cn-beijing.volceapi.com/v0.1/browsers/22afeb33-8786-46c7-b2f5-0dd63c9782a5/json/version?faasInstanceName=a5xwlfo1-uim0if6qku-reserved-59bdfc9487-6ntbd

Actual behavior

it redirected to find the devtool server to https://sd0nup096n1fcd5thd31g.apigateway-cn-beijing.volceapi.com/v0.1/browsers/22afeb33-8786-46c7-b2f5-0dd63c9782a5/?faasInstanceName=abc/json/version/ with the following issue:

https://xxx.apigateway-cn-beijing.volceapi.com/v0.1/browsers/22afeb33-8786-46c7-b2f5-0dd63c9782a5/?faasInstanceName=abc/json/version/.
This does not look like a DevTools server, try connecting via ws://..
This does not look like a DevTools server, try connecting via ws://.

Additional context

No response

Environment

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 153.72 MB / 32.00 GB
  Binaries:
    Node: 23.11.0 - /opt/homebrew/bin/node
    npm: 10.9.2 - /opt/homebrew/bin/npm
  IDEs:
    VSCode: 1.100.2 - /usr/local/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
zzxwill added a commit to zzxwill/playwright that referenced this issue May 27, 2025
The code now uses the URL constructor to handle the endpoint URL more robustly. This change ensures that the path is correctly formatted by appending a trailing slash and the 'json/version' segment, avoiding potential errors from manual string manipulation. This improves reliability when retrieving the WebSocket endpoint from the provided URL.

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

Successfully merging a pull request may close this issue.

1 participant