Matt R Asked: 2024-02-05 22:06:13 +0800 CST2024-02-05 22:06:13 +0800 CST 2024-02-05 22:06:13 +0800 CST 如何为 Playwright 组件测试指定浏览器标志? 772 在Playwright 组件测试中,有没有办法将标志传递给运行的浏览器实例?例如,对于 Chrome:--use-fake-ui-for-media-stream、--use-file-for-fake-audio-capture和类似的。 playwright 1 个回答 Voted Best Answer candre 2024-02-06T03:57:40+08:002024-02-06T03:57:40+08:00 在 playwright.config 中将launchoptions添加到项目中: export default defineConfig({ // .. projects: [ { name: "Chrome", use: { browserName: "chromium", launchOptions: { args: [ "--use-fake-ui-for-media-stream", "--use-file-for-fake-audio-capture", ], }, }, }, ], });
在 playwright.config 中将launchoptions添加到项目中: