使用Selenium无法在Edge浏览器中打开私人窗口。

问题描述 投票:0回答:1

我试过下面提到的代码,但它在我的框架中不工作.Selenium -3.141.59Microsoft Edge- 81.0.416.72。

EdgeOptions options = new EdgeOptions();
options.setCapability("inPrivate", true); 
WebDriver driver = new EdgeDriver(options);
selenium-webdriver microsoft-edge private
1个回答
0
投票

你可以尝试添加参数 inprivate 使用Selenium WebDriver使Edge Chromium在私有模式下打开。

请参考以下步骤。

从以下地方下载Selenium 4.00-alpha05的语言绑定。此处.

下载 Microsoft Edge 驱动程序的匹配版本,从 本页.

然后,使用下面的代码(它在C#和Java应用程序中很好地工作)。

    EdgeOptions edgeOptions = new EdgeOptions();
    edgeOptions.addArguments("-inprivate");
    WebDriver driver = new EdgeDriver(edgeOptions); 
© www.soinside.com 2019 - 2024. All rights reserved.