How to use Playwright's bypassCsp option?
I would like to use:
https://playwright.dev/docs/api/class-testoptions#test-options-bypass-csp
Any idea how I can do that in crawlee?
TestOptions | Playwright
Playwright Test provides many options to configure test environment, [Browser], [BrowserContext] and more.
6 Replies
View post on community site
This post has been pushed to the community knowledgebase. Any replies in this thread will be synced to the community site.
Apify Community
stormy-goldOP•8mo ago
Bump.
xenial-black•8mo ago
Hi @Jeno
You can try:
const playwrightCrawler = new PlaywrightCrawler({
launchContext: {
launchOptions: { bypassCSP: true },
},
});
stormy-goldOP•8mo ago
Hi @Lukas Celnar ,
I get this ts error:
Object literal may only specify known properties, and 'bypassCSP' does not exist in type 'LaunchOptions'. ts(2353)
xenial-black•8mo ago
Hi @Jeno
Could you please confirm that you are using playwright with latest version of crawlee?
I was able to successfully run this exact code without any error and typescript error/warning:
const crawler = new PlaywrightCrawler({
proxyConfiguration,
requestHandler: router,
headless: false,
launchContext: {
launchOptions: { bypassCSP: true },
},
});
stormy-goldOP•8mo ago
Indeed, I just updated Playwright version and it accepts the option. Thank you for your help!