Skip to content

How to Ignore Cors in Playwright

Published: at 11:04 AM

If you are testing a local site with playwright, you can run into CORS errors such as “Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at $somesite”

To fix this add to your playwright config file launch options:

 {
      name: 'chromium',
      use: {
        headless: false,
        bypassCSP: true, // add this to disable cors
        launchOptions: {
          args: ['--disable-web-security'], // add this to disable cors
        },
      },
    },