How to “hook in” puppeteer into a running Chrome instance/tab

天涯浪子 提交于 2020-08-26 06:17:06

问题


Is it somehow possible to attach puppeteer to a running Chrome instance (manually started browser) and then takeover control within a tab? I'm assuming that it's eventually related to start the Chrome browser using the --no-sandbox flag but don't know how to continue from there.

Thanks for any help


回答1:


You can use puppeteer.connect(options) (see here):

const puppeteer = require('puppeteer');

const browserWSEndpoint = 'a browser websocket endpoint to connect to';
const browser = await puppeteer.connect({browserWSEndpoint});
//continue from here


来源:https://stackoverflow.com/questions/54922410/how-to-hook-in-puppeteer-into-a-running-chrome-instance-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!