CA
robust-apricot

Is there any way to set cookies before pupeteer run?

Hi all! I'm just trying out crawlee, Is there any way to setup crawlee launch with cookies? I know there are page.setCookie() but its only avalibale in handler ~ Is there any way I can setup it in here? so I dont have to go through a default handler just to set a cookie?
await Actor.init();

const crawler = new PuppeteerCrawler({
useSessionPool: true,
sessionPoolOptions: { maxPoolSize: 100 },
persistCookiesPerSession: true,
launchContext: {
launcher: puppeteerExtra,
},
requestHandler: router,
});

await crawler.run();

// Exit successfully
await Actor.exit();
await Actor.init();

const crawler = new PuppeteerCrawler({
useSessionPool: true,
sessionPoolOptions: { maxPoolSize: 100 },
persistCookiesPerSession: true,
launchContext: {
launcher: puppeteerExtra,
},
requestHandler: router,
});

await crawler.run();

// Exit successfully
await Actor.exit();
1 Reply

Did you find this page helpful?