我使用Selenium2进行自动化网络测试。过了一会儿(不知道需要多长时间),底部会出现提示以选择数据。 " firefox自动向mozilla发送一些数据,以便我们改善您的体验。 默认情况下,如何禁用此提示(或更好的任何提示)? Selenium2是否始终使用默认配置文件的副本?
谢谢!
答案 0 :(得分:1)
您可以为Firefox创建自定义配置文件,根据需要进行设置,然后从测试中调用它:
点击此处了解更多信息:
http://www.toolsqa.com/selenium-webdriver/custom-firefox-profile/
https://automatictester.wordpress.com/2013/04/07/selenium-running-custom-firefox-profile/
答案 1 :(得分:0)
此提示与“Firefox运行状况报告”相关,默认情况下会在
中进行检查打开菜单>选项>选项(或工具>选项)>高级>数据选择
在Selenium中,您可以通过将Firefox配置文件中的以下三个属性设置为false来禁用此提示:
以下是Python演示:
profile = webdriver.FirefoxProfile()
profile.set_preference('datareporting.healthreport.uploadEnabled', False)
profile.set_preference('datareporting.healthreport.service.enabled', False)
profile.set_preference('datareporting.healthreport.service.firstRun', False)
browser = webdriver.Firefox(profile)
答案 2 :(得分:0)
DanEng答案是有关禁用运行状况报告本身的,但是(至少在标准浏览器中)通知仍在显示。
我使用新的Firefox配置文件进行测试,这使我很烦。
要在Mozilla Quantum中隐藏通知(不确定在Selenium中是否适用),请在配置文件文件夹中使用以下几行创建user.js文件:
< em> " **Test,Extract Me** " < /em>
这两行都是必需的。 从现在开始的时间是1533619817422,当我尝试10000000000时,它的确再次询问。 我的猜测是它不时地问。使用9000000000000对我有用。
我还添加了以下设置:
pref("datareporting.policy.dataSubmissionPolicyAcceptedVersion", 2);
pref("datareporting.policy.dataSubmissionPolicyNotifiedTime", "9000000000000");