puppeteer-base-project
puppeteer-base-project copied to clipboard
Receiving unhandled promise error
I am using more or less an unedited version of your code. I have only changed the node version to 10 (in package-json) and the URL was changed to ws://127.0.0.1:9222/devtools/page/CB78D72301BA21A6AF84242787987F2C (note: in your Medium post, you have two different URLs, in the json, it looks similar to mine, but in the code part later, it has devtools/browser/ and a different id style). Also, I have commented out the three lines for the Option 1.
I have received the following error:
(node:21424) UnhandledPromiseRejectionWarning: Error: Protocol error (Target.getBrowserContexts): Not allowed
at Promise (project-path\node_modules\puppeteer\lib\Connection.js:74:56)
at new Promise (<anonymous>)
at Connection.send (project-path\node_modules\puppeteer\lib\Connection.js:73:12)
at Launcher.connect (project-path\node_modules\puppeteer\lib\Launcher.js:294:50)
at process._tickCallback (internal/process/next_tick.js:68:7)
Actually, the error occurs due to my comment in brackets.
In your Medium post, you need to correct the link, the correct link is http://127.0.0.1:9222/json/version. There you'll get the browser url and then it works like a charm, thanks for the help!