如何在Selenium WebDriver中自动清除浏览器缓存? [英] How to clear browser cache automatically in Selenium WebDriver?
本文介绍了如何在Selenium WebDriver中自动清除浏览器缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在每次测试运行前清除浏览器缓存?我在创建驱动程序实例后尝试使用 driver.manage()。deleteAllCookies();
在 setUp
方法中为firefox工作,但对IE没用。有没有IE的解决方案请提供给我..
How to clear browser cache before every test run? I tried with driver.manage().deleteAllCookies();
in setUp
method after creating the driver instance, it is working for firefox, but for IE no use. Is there any solution for IE please provide me..
推荐答案
您可以按如下方式设置驱动程序功能:
There is a driver capability you can set as follows:
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
它适用于IE11。
这篇关于如何在Selenium WebDriver中自动清除浏览器缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文