可以禁用 firefox 和 chrome 默认缓存吗? [英] Possible to disable firefox and chrome default caching?

查看:25
本文介绍了可以禁用 firefox 和 chrome 默认缓存吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 firefox 缓存时遇到问题,当我更改站点重定向时,firefox 决定需要对其进行缓存.

I'm having a problem with firefox caching, when i change a site redirection firefox decides that it needs to cache this.

关键是我不想创建一个测试编辑重定向工作的测试,但是这种缓存阻止我这样做.

The point is I wan't to create a test that tests editing a redirection works, but this caching prevents me from doing this.

有没有办法禁用 firefox 缓存?还是在需要时将其删除?

Is there a way to disable firefox caching? or better yet delete it when needed?

注意:这不是 cookie,而是实际的 Firefox 缓存.

NOTE: It's not cookies but the actual firefox cache.

我正在使用 webdriver C# 版本.

I'm using webdriver C# version.

推荐答案

看看这个页面:http://code.google.com/p/selenium/issues/detail?id=40

要禁用 Firefox 缓存,您可以尝试:使用 firefox.exe -ProfileManager

To disable Firefox caching you can try: Create a new profile with firefox.exe -ProfileManager

转到 Firefox 配置文件目录并将以下内容添加到 prefs.js:

Go to the Firefox profile directory and add the following to prefs.js:

user_pref("browser.cache.disk.enable", false);
user_pref("browser.cache.memory.enable", false);
user_pref("browser.cache.offline.enable", false);
user_pref("network.http.use-cache", false);

告诉 Selenium 使用自定义的 Firefox 配置文件(这是 Java):

Tell Selenium to use the custom Firefox profile (This is Java):

ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("Selenium");
FirefoxDriver browser = new FirefoxDriver(profile);

这篇关于可以禁用 firefox 和 chrome 默认缓存吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆