如何使用Playwright在Chrome中禁用Web安全

wj8zmpe1  于 12个月前  发布在  Go
关注(0)|答案(1)|浏览(231)

使用launchOptions设置浏览器启动配置并将对象传递给浏览器示例。

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

browser = await browserType.LaunchAsync(launchOptions);

字符串

ca1c2owp

ca1c2owp1#

从playwright.config.ts使用下面的配置,

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

字符串

相关问题