pptr connect with electron failed
See original GitHub issueenvironment:
- Puppeteer version: 1.6.2
- Platform / OS version: win10 electron 4.0.1
- Node.js version: 10.11.0
description
Because electron app is a chromium, so I want to use puppeteer.connect()
connect with electron.
I already set electron’s chromium with --remote-debugging-port=9223
.
when electron started, I open http://localhost:9223/json/version
, can get :
{
"Browser": "Chrome/69.0.3497.106",
"Protocol-Version": "1.3",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.106 Electron/4.0.1 Safari/537.36",
"V8-Version": "6.9.427.24",
"WebKit-Version": "537.36 (@857b284701ddf7bef0f14fa76416cf7ca786b411)",
"webSocketDebuggerUrl": "ws://localhost:9223/devtools/browser/xxxxxxx"
}
Then, I use webSocketDebuggerUrl
set to connect()
args :
puppeteer.connect({
browserWSEndpoint: "ws://localhost:9223/devtools/browser/xxxxxxx"
}).then(async browser => {
const page = await browser.newPage();
}).catch(e => {
console.log(e)
})
when I run this script, log error :
{ Error: Protocol error (Target.getBrowserContexts): Not supported
at Promise (C:\WorkSpace\test\pptr-test\node_modules\puppeteer\lib\Connection.js:86:56)
at new Promise (<anonymous>)
at Connection.send (C:\WorkSpace\test\pptr-test\node_modules\puppeteer\lib\Connection.js:85:12)
at Function.connect (C:\WorkSpace\test\pptr-test\node_modules\puppeteer\lib\Launcher.js:257:50)
at process._tickCallback (internal/process/next_tick.js:68:7)
message: 'Protocol error (Target.getBrowserContexts): Not supported' }
Then I try other different version puppeteer, but also log above error. Include puppeteer@1.6.x
that support chromium’s version equal 69.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Error: Failed to launch the browser process puppeteer
I had the same issue, I tried everything which is listed from the Puppeteer guide, none of them worked for me.
Read more >Supported Command Line Switches - Electron
Command line switches supported by Electron. You can use app.commandLine.appendSwitch to append them in your app's main script before the ready event of...
Read more >All the Electron Docs! | Electron
Returns String - A path to a special directory or file associated with name . On failure an Error is thrown. You can...
Read more >webContents | FAQ - GitHub Pages
This event is like did-finish-load but emitted when the load failed or was cancelled, ... status indicates the socket connection to download the...
Read more >@elavoie/electron-webrtc - npm
Use WebRTC in Node.js via a hidden Electron process. ... errors that may occur when trying to communicate with Electron wrtc.on('error', ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Trying to achieve the same thing and running into the same issue. 😕
Here’s a demo snippet
@LarenDorr Electron is a custom embedder - and a few DevTools protocol methods are expected to be implemented in an embedder. One of these methods is
Target.getBrowserContexts
. Until electron supports it upstream, Puppeteer’s browser contexts won’t work with electron.As a workaround, you can try using Puppeteer v1.4.0.
We, however, can make it mostly work with Electron - things like clicking, typing and navigations should be working just fine. Closing this in favor of https://github.com/GoogleChrome/puppeteer/issues/4283 - there’s some more context. Let’s continue discussion there.