5

I've been using the Ruby selenium-webdriver gem to perform some testing on a web app at work. One thing that would be great would be the ability to programmatically clear the browsers cache before performing timed page loads etc but I can't seem to find anything in the documentation.

Does anyone know if is there a simple way of doing this with the gem?

seadowg
  • 4,215
  • 6
  • 35
  • 43

3 Answers3

3

I don't have enough reputation to comment on jacksparrow007's answer, but in Ruby Selenium, his suggestion could be coded as:

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.cache.disk.enable'] = false
profile['browser.cache.memory.enable'] = false
profile['browser.cache.offline.enable'] = false
profile['network.http.use-cache'] = false
Selenium::WebDriver.for :firefox, :profile => profile
CaseyG
  • 31
  • 3
2

Hope this helps!

@driver.manage.delete_all_cookies
Prashanth Sams
  • 19,677
  • 20
  • 102
  • 125
0

I think you can do this by making a custom firefox profile and then telling your driver to use that. check this out.

jacksparrow007
  • 1,298
  • 4
  • 19
  • 30