繁体   English   中英

在私有模式下运行Internet Explorer Selenium Web驱动程序C#

[英]Running Internet Explorer selenium web driver in private mode c#

我正在使用Selenium构建UI自动化测试,并且想使用Internet Explorer浏览器测试我们的产品。 我正在尝试使用硒3.4创建InternetExplorerDriver。

但是,当我将选项设置为在私有模式下运行时,IE浏览器不会启动。 我设置的选项是:

ForceCreateProcessApi = true,

BrowserCommandLineArguments = "-private".

private IWebDriver CreateInternetExplorerDriver()
    {
        InternetExplorerOptions options = new InternetExplorerOptions()
        {
            IntroduceInstabilityByIgnoringProtectedModeSettings = true,
            IgnoreZoomLevel = true,
            InitialBrowserUrl = "about:InPrivate",
            EnsureCleanSession = true,
            BrowserCommandLineArguments = "-private",
            ForceCreateProcessApi = true
        };

        // Create a webdriver instance to automate the browser.
        return new InternetExplorerDriver(_webDriverDirectory, options, TimeSpan.FromSeconds(DriverCommandTimeout * 3));
    }

该代码在VS 2017,Windows 10,64位中运行,并尝试运行32位Internet Explorer驱动程序。

通过使用IEDriverServer_x64_3.8.0解决。 可能是3.9和32位版本中的错误

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM