Auto-dismiss Welcome to Chrome dialog; add suppress flags for first-run popups

This commit is contained in:
2026-05-22 00:56:08 +00:00
parent 08f296ceb3
commit 18bb48b874
+16 -9
View File
@@ -505,6 +505,9 @@ def launch_chrome():
"--disable-session-crashed-bubble",
"--disable-save-password-bubble",
"--disable-restore-session-state",
"--suppress-message-center-popups",
"--disable-default-browser-check",
"--no-first-run",
"--disable-features=TranslateUI,OptimizationHints,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationGuideModelDownloading",
"--disable-component-update",
"--disable-background-networking",
@@ -536,17 +539,21 @@ if __name__ == "__main__":
def dismiss_chrome_dialogs():
"""
Chrome sometimes shows a 'Profile error occurred' dialog on startup.
This runs in the background and closes it automatically so the senior
never sees it. We try a few times over 10 seconds to catch it.
Chrome shows startup dialogs (first-run welcome, profile errors) on a
fresh or corrupted profile. Dismiss them all automatically so the
senior never sees them. Runs for ~15 seconds after startup.
"""
for _ in range(10):
dialogs = [
"Welcome to Google Chrome",
"Profile error occurred",
]
for _ in range(15):
time.sleep(1)
subprocess.run(
["xdotool", "search", "--name", "Profile error occurred",
"key", "Return"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
)
for title in dialogs:
subprocess.run(
["xdotool", "search", "--name", title, "key", "Return"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
)
def init_cdp():
if cdp.wait_ready(timeout=30):