From 18bb48b8747d648d349c420122375351aadc4d67 Mon Sep 17 00:00:00 2001 From: jgitta Date: Fri, 22 May 2026 00:56:08 +0000 Subject: [PATCH] Auto-dismiss Welcome to Chrome dialog; add suppress flags for first-run popups --- browser.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/browser.py b/browser.py index 9dcff4d..e23ed19 100755 --- a/browser.py +++ b/browser.py @@ -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):