Is it possible to reattach to an existing puppeteer ?
You can connect to an existing using the connect function: const browserURL = 'http://127.0.0.1:21222'; const browser = await puppeteer. connect({browserURL}); But, if you want to use those 2 lines you need to launch Chrome with the "--remote-debugging-port=21222 argument.
Puppeteer is a Node library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome or Chromium.
Puppeteer is a Node. js library developed by Google that lets you control headless Chrome through the DevTools Protocol. It is a tool for automating testing in your application using headless Chrome or Chromebit devices, without requiring any browser extensions like Selenium Webdriver or PhantomJS.
The default download path is node_modules/puppeteer/. local-chromium .
For those who stumble upon this, here's an example of how I've got it working:
const puppeteer = require('puppeteer');
puppeteer.connect({"browserWSEndpoint" : "ws://some_string"}).then(async browser => {
console.log("bla bla");
...
});
The browser.wsEndpoint you can find from the previous session:
const endpoint = browser.wsEndpoint();
Browser websocket endpoint which can be used as an argument to puppeteer.connect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With