Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension doesn't work #543

Open
silvestrodecaro opened this issue Jul 7, 2024 · 0 comments
Open

Extension doesn't work #543

silvestrodecaro opened this issue Jul 7, 2024 · 0 comments

Comments

@silvestrodecaro
Copy link

silvestrodecaro commented Jul 7, 2024

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.

Screenshot

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));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant