Skip to content

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

chore(chromium): nicer error when running as root without --no-sandbox (#2214)

Yury Semikhatskyf10e8c4d4725
diff --git a/src/server/chromium.ts b/src/server/chromium.ts
index 909443b32c..2cb6d881fb 100644
--- a/src/server/chromium.ts
+++ b/src/server/chromium.ts
@@ -95,6 +95,9 @@ export class Chromium extends AbstractBrowserType<CRBrowser> {
temporaryUserDataDir = userDataDir;
}
+ const runningAsRoot = process.geteuid && process.geteuid() === 0;
+ assert(!runningAsRoot || args.includes('--no-sandbox'), 'Cannot launch Chromium as root without --no-sandbox. See https://crbug.com/638180.');
+
const chromeArguments = [];
if (!ignoreDefaultArgs)
chromeArguments.push(...this._defaultArgs(options, launchType, userDataDir));