如何在Selenium IDE for Python2中更改Firefox缓存大小的值?

问题描述 投票:0回答:1

可以像browser.cache.disk.capacity一样使用here在浏览器的Firefox中更改缓存大小值。

我试图改写建议的代码here

profile = webdriver.FirefoxProfile()
profile.set_preference("browser.cache.disk.capacity", 9113600)
driver = webdriver.Firefox(profile)

但是这没有用,仍然导致

enter image description here

如何使用带有python2的Selenium IDE在Firefox中更改缓存大小的值?

提前感谢。

python selenium selenium-webdriver selenium-ide
1个回答
0
投票

好吧,我能够弄清楚,这并不难。

首先,请检查~/.mozilla/firefox/profiles.ini中的配置文件。我建议您使用默认值。您也可以使用命令行firefox -p创建新的配置文件,以在启动时显示该配置文件。

~/.mozilla/firefox/中,您还会找到ng6ufigq.default之类的文件夹,其中包含该配置文件的配置参数,特别是prefs.js。打开此文件并将browser.cache.disk.capacity更改为任何所需的值,然后保存。

最后,在python脚本中:

profile = webdriver.FirefoxProfile('~/.mozilla/firefox/ng6ufigq.default')
self.driver = webdriver.Firefox(profile)

然后该脚本将使用给定的配置文件设置启动。

© www.soinside.com 2019 - 2024. All rights reserved.