我需要在浏览器上下文之外调用外部api /模块,然后在if语句之后切换回puppeteer上下文。 感谢您的协助。
const puppeteer =require('puppeteer');
(async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('https://example.com');
await page.evaluate(() => {
var x =
document.documentElement.outerHTML
var s = x.includes('Example')
if (s = true) {
// **Must simply use other module / {api} and switch back to puppeteer
context**
}
});
})();