Python/Selenium – Clear the cache and cookies in my chrome webdriver?


I’m trying to clear the cache and cookies in my chrome browser (webdriver from selenium) but I can’t find any solutions for specifically the chrome driver. How do I clear the cache and cookies in Python? Thanks!


Taken from this post:

For cookies, you can use the delete_all_cookies function:


For cache, there isn’t a direct way to do this through Selenium. If you are trying to make sure everything is cleared at the beginning of starting a Chrome driver, or when you are done, then you don’t need to do anything. Every time you initialize a webdriver, it is a brand new instance with no cache, cookies, or history. Every time you terminate the driver, all these are cleared.

Answered By – R.F. Nelson

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published