Extension doesn't work
silvestrodecaro opened this issue · 0 comments
silvestrodecaro commented
I'm trying to load CapSolver's extension on my browser instances generated with Puppeteer Cluster, but it seems that the extension only works on the about:blank instance (the instance that Puppeteer Cluster creates when you use CONCURRENCY_CONTEXT) and not on the actual browsing instances.
const { Cluster } = require('puppeteer-cluster');
(async () => {
const pathToExtension = require('path').join(__dirname, 'capsolver');
const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_CONTEXT,
maxConcurrency: 2,
puppeteerOptions: {
headless: false,
args: [
`--disable-extensions-except=${pathToExtension}`,
`--load-extension=${pathToExtension}`,
],
},
});
await cluster.task(async ({ page, data: url }) => {
await page.goto(url);
await delay(60000);
});
cluster.queue('http://www.google.com/');
cluster.queue('http://www.wikipedia.org/');
// many more pages
await cluster.idle();
await cluster.close();
})();
function delay(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}