Apify and Crawlee Official Forum

Updated 2 months ago

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?
J
L
5 comments
Hi @Jeno
You can try:

const playwrightCrawler = new PlaywrightCrawler({ launchContext: { launchOptions: { bypassCSP: true }, }, });
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)
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 }, }, });
Indeed, I just updated Playwright version and it accepts the option. Thank you for your help!
Add a reply
Sign up and join the conversation on Discord