xvrh / puppeteer-dart

A Dart library to automate the Chrome browser over the DevTools Protocol. This is a port of the Puppeteer API
BSD 3-Clause "New" or "Revised" License
236 stars 59 forks source link

[help] can't puppeteer.connect with my web app on Windows #233

Closed Joseph-Nathan closed 1 year ago

Joseph-Nathan commented 1 year ago

i have same web app project on Mac and it work fine , i copied the project to Windows machine and the package work fine , but i can't puppeteer.connect(browserWsEndpoint:ws); with my web app the function was freeze and no thing happened ,

is there any thing to do with environment to solve this .

xvrh commented 1 year ago

That's weird. If you can come up with a small reproducible example, I can have a look.

We have a test here: https://github.com/xvrh/puppeteer-dart/blob/master/test/connect_on_web_test.dart to show how to connect to puppeteer from a web page.

Recently we hit a bug with that test: starting from Chrome 111, we cannot make a direct websocket connection from the webpage to the Chrome devtools. The server refuses the connection or something. I had to add a proxy in-between to make the bridge. See the comment in the code.

Joseph-Nathan commented 1 year ago

thanks , i downgrade to Chromium 110 and it work ,

xvrh commented 1 year ago

Actually, I just found a solution here: https://groups.google.com/g/chromedriver-users/c/xL5-13_qGaA

We can launch puppeteer with the --remote-allow-origins=* flag and it works for even in chrome >=111

ie.

var browser = await puppeteer.launch(args: ['--remote-allow-origins=*']);