0
点赞
收藏
分享

微信扫一扫

playwright 关闭无痕浏览模式

使用 launchPersistentContext 即可,需提供一个文件夹存放 cookie 等数据

// @ts-check
const { chromium } = require("playwright");
const path = require('path');

(async () => {
    // Make sure to run headed.
    const browser = await chromium.launchPersistentContext(path.resolve("./userData"), {
        executablePath: "C:/Program Files/Google/Chrome/Application/chrome.exe",
        headless: false,
    });
    const [page] = browser.pages();
     
})();

举报

相关推荐

0 条评论