如何使用带有多个选项卡的Selenium-Java以隐身模式打开Web浏览器

时间:2016-05-12 08:57:14

标签: java google-chrome selenium

我想使用Selenium(Java)以隐身模式打开浏览器窗口,其中包含多个选项卡。浏览器一启动就应该平行打开3个标签。

1 个答案:

答案 0 :(得分:0)

铬:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("incognito");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);

Internet Explorer:

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true); 
capabilities.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private");