本文介绍了InPrivate模式下在Internet Explorer中进行硒测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以在Internet Explorer 9中以IEDriverServer在InPrivate模式下运行Selenium自动化测试吗?我需要测试2个(两个)测试用例:
1.浏览器已关闭.打开IE InPrivate模式的一个窗口.运行测试.
2.在正常模式下打开浏览器.打开IE InPrivate模式的新窗口.运行测试.
Is there any way how to run Selenium automation test in Internet Explorer 9 in InPrivate mode with IEDriverServer? I need to test 2 (two) testcases:
1. browser is closed. Open one window of IE InPrivate mode. Run test.
2. browser is opened in normal mode. Open new window of IE InPrivate mode. Run test.
JAVA代码应如何查找此测试?
谢谢
How should JAVA code look for this tests?
Thank you
推荐答案
public void openBrowserInPrivacyMode(boolean isBrowserActive) {
System.setProperty("webdriver.ie.driver", "path/to/IEDriverServer_x32.exe");
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true);
сapabilities.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private");
InternetExplorerDriver driver = new InternetExplorerDriver(capabilities);
这篇关于InPrivate模式下在Internet Explorer中进行硒测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!