Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix: PowerShell execution policies (#9885)

Max Schmittbff84c53918d
diff --git a/packages/playwright-core/src/utils/dependencies.ts b/packages/playwright-core/src/utils/dependencies.ts
index d52e4b6df3..bbac2ba2a7 100644
--- a/packages/playwright-core/src/utils/dependencies.ts
+++ b/packages/playwright-core/src/utils/dependencies.ts
@@ -40,7 +40,7 @@ export type DependencyGroup = 'chromium' | 'firefox' | 'webkit' | 'tools';
export async function installDependenciesWindows(targets: Set<DependencyGroup>) {
if (targets.has('chromium')) {
- const { code } = await utils.spawnAsync('powershell.exe', ['-File', path.join(BIN_DIRECTORY, 'install_media_pack.ps1')], { cwd: BIN_DIRECTORY, stdio: 'inherit' });
+ const { code } = await utils.spawnAsync('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-File', path.join(BIN_DIRECTORY, 'install_media_pack.ps1')], { cwd: BIN_DIRECTORY, stdio: 'inherit' });
if (code !== 0)
throw new Error('Failed to install windows dependencies!');
}
diff --git a/packages/playwright-core/src/utils/registry.ts b/packages/playwright-core/src/utils/registry.ts
index 59b4d149d6..5286f027d1 100644
--- a/packages/playwright-core/src/utils/registry.ts
+++ b/packages/playwright-core/src/utils/registry.ts
@@ -625,7 +625,7 @@ export class Registry {
const isPowerShell = scriptName.endsWith('.ps1');
const shell = isPowerShell ? 'powershell.exe' : 'bash';
const args = [
- ...(isPowerShell ? ['-File'] : []),
+ ...(isPowerShell ? ['-ExecutionPolicy', 'Bypass', '-File'] : []),
path.join(BIN_PATH, scriptName),
...scriptArgs
];