使用硒在InPrivate模式下打开Edge [英] Open Edge in InPrivate mode using Selenium
问题描述
我正在使用Selenium 3.4通过现在由Microsoft维护的Microsoft WebDriver启动Edge.
I am using Selenium 3.4 to launch Edge using the Microsoft WebDriver which is now maintained by Microsoft.
有什么方法可以使用Selenium以InPrivate模式启动浏览器?
Is there any way I can launch the Browser in InPrivate mode using Selenium?
我已经搜索了答案,但是找不到答案.
I have searched for answers but couldn't find any.
我最接近的是如何使用硒远程Webdriver在隐身模式下启动Edge浏览器?
那里提到的解决方案不起作用.它只显示与InPrivate中显示的选项卡相同的选项卡,但该窗口不是私有窗口.这样,信息被存储并且会话不是私有的.
The solution mentioned there doesn't work. It just shows the same tab as would be shown in InPrivate, but the window isn't a private one. As such, the information is stored and the session is not private.
推荐答案
添加功能... 尝试下面的代码.
Add capabilities... Try the code below.
DesiredCapabilities capabilities = DesiredCapabilities.edge();
capabilities.setCapability("ms:inPrivate", true);
return new EdgeDriver(capabilities);
这篇关于使用硒在InPrivate模式下打开Edge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!