How to clear browser cache in Selenium test

前端 未结 3 1747
遇见更好的自我
遇见更好的自我 2021-01-02 01:40

I am running my Selenium tests with WebDriver. I am repeating the tests with some loop so now I want to Clear the cache before starting new test in JAVA.

@Te         


        
3条回答
  •  长情又很酷
    2021-01-02 02:09

    Currently, there is no way to clear the cache through the web driver API. However, if you can start a new instance of the browser each time, the cache should be cleared in FF and Chrome because a new profile is created on each launch.

    The comments for issue #40 (Clear cache) in the Selenium issue tracker list two potential solutions to your problem if creating a new browser instance isn't possible:

    1. Clear the IE cache from the command line
    2. Disable the FF cache using a custom profile

    HTH

提交回复
热议问题