我正在使用puppeteer启动新的Chrome浏览器窗口:
const util = require('util');
const puppeteer = require('puppeteer');
(async () => {
const b = await puppeteer.launch({
headless: false,
devtools: true, // open DevTools when window launches
args: ['--remote-debugging-port=9222']
});
console.log('browser:', util.inspect(b));
const c = await puppeteer.connect({
browserWSEndpoint: b._connection._url, //`ws://${host}:${port}/devtools/browser/<id>`,
ignoreHTTPSErrors: false
});
console.log('connection =>', c);
})();
我的问题是 - 如何使用websocket连接c
将DevTools协议消息发送到浏览器窗口?我想打开一个新标签,并执行其他操作。有谁知道怎么样?