Auto-dismiss Welcome to Chrome dialog; add suppress flags for first-run popups
This commit is contained in:
+16
-9
@@ -505,6 +505,9 @@ def launch_chrome():
|
|||||||
"--disable-session-crashed-bubble",
|
"--disable-session-crashed-bubble",
|
||||||
"--disable-save-password-bubble",
|
"--disable-save-password-bubble",
|
||||||
"--disable-restore-session-state",
|
"--disable-restore-session-state",
|
||||||
|
"--suppress-message-center-popups",
|
||||||
|
"--disable-default-browser-check",
|
||||||
|
"--no-first-run",
|
||||||
"--disable-features=TranslateUI,OptimizationHints,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationGuideModelDownloading",
|
"--disable-features=TranslateUI,OptimizationHints,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationGuideModelDownloading",
|
||||||
"--disable-component-update",
|
"--disable-component-update",
|
||||||
"--disable-background-networking",
|
"--disable-background-networking",
|
||||||
@@ -536,17 +539,21 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
def dismiss_chrome_dialogs():
|
def dismiss_chrome_dialogs():
|
||||||
"""
|
"""
|
||||||
Chrome sometimes shows a 'Profile error occurred' dialog on startup.
|
Chrome shows startup dialogs (first-run welcome, profile errors) on a
|
||||||
This runs in the background and closes it automatically so the senior
|
fresh or corrupted profile. Dismiss them all automatically so the
|
||||||
never sees it. We try a few times over 10 seconds to catch it.
|
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)
|
time.sleep(1)
|
||||||
subprocess.run(
|
for title in dialogs:
|
||||||
["xdotool", "search", "--name", "Profile error occurred",
|
subprocess.run(
|
||||||
"key", "Return"],
|
["xdotool", "search", "--name", title, "key", "Return"],
|
||||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
||||||
)
|
)
|
||||||
|
|
||||||
def init_cdp():
|
def init_cdp():
|
||||||
if cdp.wait_ready(timeout=30):
|
if cdp.wait_ready(timeout=30):
|
||||||
|
|||||||
Reference in New Issue
Block a user