Change cache location for Selenium

186 Views Asked by At

I'm using Selenium 4.16.0 for Python, on Windows 10.

How can I change the default cache location ?

The default cache location is "~/user/.cache", a directory.

But I get errors since another program use "~/user/.cache", a file.

1

There are 1 best solutions below

1
lukos06 On

If you are using Firefox, the alternative solution is that you can set the --profile option to specify a custom user data directory.

firefox_options = webdriver.FirefoxOptions()
firefox_options.add_argument("--profile=/path/to/custom/cache/location")

driver = webdriver.Firefox(options=firefox_options)