如何“钩"入操纵人到正在运行的Chrome实例/标签中 [英] How to "hook in" puppeteer into a running Chrome instance/tab

查看:106
本文介绍了如何“钩"入操纵人到正在运行的Chrome实例/标签中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过其他方式将puppeteer附加到正在运行的Chrome实例(手动启动的浏览器)上,然后在选项卡中进行接管控制?我假设它最终与使用--no-sandbox标志启动Chrome浏览器有关,但不知道如何从那里继续.

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.

感谢您的帮助

推荐答案

您可以使用puppeteer.connect(options)(请参阅

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

这篇关于如何“钩"入操纵人到正在运行的Chrome实例/标签中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆