-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Playwright connectOverCDP() not working #9911
Playwright connectOverCDP() not working #9911
Comments
Experiencing same issue :/ |
I faced the same issue here as well |
I have set up a repo here: It uses nx and has 3 test cases (see readme)
Edit 2024-11-03: Edit 2024-07-28: `error: overCDP: WebSocket error: ws://localhost:9555/devtools/browser/8b68f908-be47-4a64-99d1-81c37df5fccb 200 OK
|
Same issue with the latest version bun throw an error message but the problem still persist... |
any news ? |
Does anyone know where exactly the issue lies? |
Still persist, any updates? |
Any update on this? message: 'TimeoutError: browserType.connectOverCDP: Timeout 30000ms exceeded.\n' + |
Bump. Having exactly the same issue. Example: import { chromium } from 'playwright';
const wsUrl = 'the_ws_url'
browser = await chromium.connect(wsUrl, {
timeout: 120000
}); // this is throwing with bun, same with "connectOverCDP" Using:
|
@Jarred-Sumner @dylan-conway @paperdave @nektro @cirospaciari I can't help but notice the abundance of reproduction examples here. Could someone at least remove the It would be truly wonderful if someone from the team could spare their precious time to grace us with even a single comment on this issue. This is Playwright after all - not some obscure package - and clearly many developers are running into this problem. But instead, what do we get? @Electroid going through related issues and marking them as duplicates... of themselves? Seriously? Look at that - issue that comes up first in google results. Perhaps we could get some actual attention on this issue instead of this circular duplicate-marking dance? |
Playwright support plz... |
@Jarred-Sumner any updates on this? Playwright is widely used, and websockets too. Having this solved would allow us to switch our tooling to bun. |
looking for Playwright with websockets |
Update: I'm actively investigating this. Fixes will likely coincide with the rest of I'll provide more update as I have them. |
Update: I've tracked down the problem. Since bun's HTTP client implementation does not support websocket upgrades; instead, websocket clients must use This normally works fine. Until you try to bundle I'll be making a PR into their codebase shortly, which should fix this. |
If you want this fix now, without waiting for our PR into playwright to land, you can use First, prepare bun patch node_modules/playwright-core
# or, to patch it everywhere, run `bun patch playwright-core` Then, edit -const ws = exports.ws = require('./utilsBundleImpl').ws;
+const ws = exports.ws = 'Bun' in globalThis ? require('ws') : require('./utilsBundleImpl').ws; By running: pushd node_modules/playwright-core
# Open lib/utilsBundle.js in your favorite editor. Make the above change
popd Finally, complete the patch by running # if you want this patch applied everywhere, use `playwright-core` instead
bun patch --commit node_modules/playwright-core --patches-dir=.patches You should see this patch in diff --git a/lib/utilsBundle.js b/lib/utilsBundle.js
index 9d4258e5f0edc3447214d37ea28651675ba19e30..5e0ed26ace3c3ca70155c5b43331ab4f2ea2bc19 100644
--- a/lib/utilsBundle.js
+++ b/lib/utilsBundle.js
@@ -43,7 +43,7 @@ const program = exports.program = require('./utilsBundleImpl').program;
const progress = exports.progress = require('./utilsBundleImpl').progress;
const SocksProxyAgent = exports.SocksProxyAgent = require('./utilsBundleImpl').SocksProxyAgent;
const yaml = exports.yaml = require('./utilsBundleImpl').yaml;
-const ws = exports.ws = require('./utilsBundleImpl').ws;
+const ws = exports.ws = 'Bun' in globalThis ? require('ws') : require('./utilsBundleImpl').ws;
const wsServer = exports.wsServer = require('./utilsBundleImpl').wsServer;
const wsReceiver = exports.wsReceiver = require('./utilsBundleImpl').wsReceiver;
const wsSender = exports.wsSender = require('./utilsBundleImpl').wsSender; And your "patchedDependencies": {
// 1.50.0 will be whatever version of playwright-core you have installed
"[email protected]": ".patches/[email protected]"
} |
What version of Bun is running?
1.1.0+5903a6141
What platform is your computer?
Darwin 23.4.0 arm64 arm
What steps can reproduce the bug?
I'm trying to use Playwright's connectOverCDP to access an existing Chrome browser in debug mode. This is for a web scraping project. I've returned to Nodejs and everything works fine, but keen to try bun more.
My setup
I run chrome using:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=chrome-user-data-dir --profile-directory=Default
Code:
Bun Error message:
In Nodejs it connects and works as expected.
Thanks for all your great work!
Jason
What is the expected behavior?
A new Chrome tab is opened to google.com and then closed after 5 seconds.
What do you see instead?
Bun Error message:
Additional information
No response
The text was updated successfully, but these errors were encountered: