Search code examples
seleniumgoogle-chromeselenium-webdriverselenium-chromedriver

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?


Solution

  • 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.