1717
1818// No dependencies as it is used from the Electron loader.
1919
20- const disabledFeatures = [
20+ const disabledFeatures = ( assistantMode ?: boolean ) => [
2121 // See https://github.com/microsoft/playwright/pull/10380
2222 'AcceptCHFrame' ,
2323 // See https://github.com/microsoft/playwright/pull/10679
@@ -47,9 +47,10 @@ const disabledFeatures = [
4747 'ThirdPartyStoragePartitioning' ,
4848 // See https://github.com/microsoft/playwright/issues/16126
4949 'Translate' ,
50- ] ;
50+ assistantMode ? 'AutomationControlled' : '' ,
51+ ] . filter ( Boolean ) ;
5152
52- export const chromiumSwitches = [
53+ export const chromiumSwitches = ( assistantMode ?: boolean ) => [
5354 '--disable-field-trial-config' , // https://source.chromium.org/chromium/chromium/src/+/main:testing/variations/README.md
5455 '--disable-background-networking' ,
5556 '--disable-background-timer-throttling' ,
@@ -63,7 +64,7 @@ export const chromiumSwitches = [
6364 '--disable-default-apps' ,
6465 '--disable-dev-shm-usage' ,
6566 '--disable-extensions' ,
66- '--disable-features=' + disabledFeatures . join ( ',' ) ,
67+ '--disable-features=' + disabledFeatures ( assistantMode ) . join ( ',' ) ,
6768 '--allow-pre-commit-input' ,
6869 '--disable-hang-monitor' ,
6970 '--disable-ipc-flooding-protection' ,
@@ -73,7 +74,6 @@ export const chromiumSwitches = [
7374 '--force-color-profile=srgb' ,
7475 '--metrics-recording-only' ,
7576 '--no-first-run' ,
76- '--enable-automation' ,
7777 '--password-store=basic' ,
7878 '--use-mock-keychain' ,
7979 // See https://chromium-review.googlesource.com/c/chromium/src/+/2436773
@@ -83,4 +83,5 @@ export const chromiumSwitches = [
8383 '--disable-search-engine-choice-screen' ,
8484 // https://issues.chromium.org/41491762
8585 '--unsafely-disable-devtools-self-xss-warnings' ,
86- ] ;
86+ assistantMode ? '' : '--enable-automation' ,
87+ ] . filter ( Boolean ) ;
0 commit comments