how to disable web security in chrome using playwright

693 Views Asked by At

Use the launchOptions to set the browser launch configurations and pass the object to the browser instance.

var launchOptions = new BrowserTypeLaunchOptions
 {
     Headless = false,
     Args = new[] { "--disable-web-security" }
 };

browser = await browserType.LaunchAsync(launchOptions);
1

There are 1 best solutions below

0
On

from playwright.config.ts use the below config,

const config: PlaywrightTestConfig = {
  projects: [
    {
      name: 'chromium',
      use: {
        launchOptions: {
          args: ['--disable-web-security'],
        }
      },
    }
  ]
}