Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions browse/src/browser-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,15 @@ export class BrowserManager {
// Extensions only work in headed mode, so we use an off-screen window.
const extensionsDir = process.env.BROWSE_EXTENSIONS_DIR;
const { STEALTH_LAUNCH_ARGS } = await import('./stealth');
const launchArgs: string[] = [...STEALTH_LAUNCH_ARGS];
const launchArgs: string[] = [
...STEALTH_LAUNCH_ARGS,
'--disable-dev-shm-usage',
'--no-sandbox',
];
let useHeadless = true;

// Docker/CI: Chromium sandbox requires unprivileged user namespaces which
// are typically disabled in containers. Detect container environment and
// add --no-sandbox automatically.
if (process.env.CI || process.env.CONTAINER) {
launchArgs.push('--no-sandbox');
}

// are typically disabled in containers. --no-sandbox already added above.
if (extensionsDir) {
launchArgs.push(
`--disable-extensions-except=${extensionsDir}`,
Expand Down Expand Up @@ -276,6 +275,8 @@ export class BrowserManager {
const extensionPath = this.findExtensionPath();
const launchArgs = [
'--hide-crash-restore-bubble',
'--disable-dev-shm-usage',
'--no-sandbox',
// Anti-bot-detection: remove the navigator.webdriver flag that Playwright sets.
// Sites like Google and NYTimes check this to block automation browsers.
'--disable-blink-features=AutomationControlled',
Expand Down