Puppeteer with Brave browser?

不问归期 提交于 2020-08-26 09:32:48

问题


I'm wondering if it's possible executing a puppeteer script using Brave browser instead of the basic version of chromium. I know that Brave has been developed from chromium, and for that reason you can launch a selenium script using brave, but do you know if it's possible with puppeteer as well?


回答1:


Yes, you can use Brave. The only catch is the adblocking doesn't work with headless mode. For the adblocking in headful mode, you need to set/create a profile and point the userDataDir option to it because Brave downloads the filter lists the first time it launches and stores those lists in the profile.

const browser = await puppeteer.launch({
        headless: false,
        executablePath: "path/to/brave",
        userDataDir: "path/to/profile/dir"
});


来源:https://stackoverflow.com/questions/59482893/puppeteer-with-brave-browser

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