Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable automatic updates of Chrome when run with Selenium?

I have an automatic test suite that uses Selenium to control a Chrome browser with a particular version. However Chrome tries to update itself between test runs. How do I prevent Chrome from automatically updating itself?

like image 693
David Foster Avatar asked Sep 05 '25 03:09

David Foster


1 Answers

Removing write permission from the Google Chrome binary appears to prevent it from self-updating, at least on macOS and Linux.

In Python you can do that with code that looks like:

import subprocess

def remove_write_permissions(itempath: str) -> None:
    subprocess.run([
        'chmod',
        '-R',
        'a-w',
        itempath
    ], check=True, capture_output=True)

remove_write_permissions('/Applications/Google Chrome.app')

This specific code works on macOS. Similar code works on Linux when you target the Chrome binary. I haven't tested this approach on Windows.

like image 51
David Foster Avatar answered Sep 07 '25 21:09

David Foster