Skip to content
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const chromiumSwitches = (options?: { android?: boolean }) => [
'--unsafely-disable-devtools-self-xss-warnings',
// Edge can potentially restart on Windows (msRelaunchNoCompatLayer) which looses its file descriptors (stdout/stderr) and CDP (3/4). Disable until fixed upstream.
'--edge-skip-compat-layer-relaunch',
'--enable-automation',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was removed in this change after some back and forth changes. The idea was that when browser is controlled via remote debugger, the same features are already turned on. --enable-automation is a big hammer and we haven't heard any complaints after removing the flag. Let's narrow down what is not working in their scenario and see if we can fix it differently.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless im misreading the code, that change always set --enable-automation unless assistantMode: true, which was only for MCP, meaning that --enable-automation was always on for all other cases

furthermore, it was unconditionally added and has been unconditionally set since b20e87d 7yrs ago

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as the original issue demonstrates, Chromium also uses --enable-automation to disable process handoff behavior https://issues.chromium.org/issues/371112535

// This disables Chrome for Testing infobar that is visible in the persistent context.
// The switch is ignored everywhere else, including Chromium/Chrome/Edge.
'--disable-infobars',
Expand Down
8 changes: 8 additions & 0 deletions packages/playwright-core/src/tools/mcp/browserFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,18 @@ async function createIsolatedBrowser(config: FullConfig, clientInfo: ClientInfo)
testDebug('create browser (isolated)');
const browserType = playwright[config.browser.browserName];
const tracesDir = await computeTracesDir(config, clientInfo);
const configIgnoreDefaultArgs = config.browser.launchOptions?.ignoreDefaultArgs;
const browser = await browserType.launch({
tracesDir,
...config.browser.launchOptions,
handleSIGINT: false,
handleSIGTERM: false,
ignoreDefaultArgs: configIgnoreDefaultArgs === true
? true
: [
'--enable-automation',
...Array.isArray(configIgnoreDefaultArgs) ? configIgnoreDefaultArgs : [],
],
}).catch(error => {
throwIfExecutableMissing(error, config);
throw error;
Expand Down Expand Up @@ -175,6 +182,7 @@ async function createPersistentBrowser(config: FullConfig, clientInfo: ClientInf
? true
: [
'--disable-extensions',
'--enable-automation',
...Array.isArray(configIgnoreDefaultArgs) ? configIgnoreDefaultArgs : [],
],
};
Expand Down
Loading