【问题标题】:Microsoft Edge not stay open when run by Microsoft WebDriver由 Microsoft WebDriver 运行时,Microsoft Edge 不会保持打开状态
【发布时间】:2018-04-06 19:57:05
【问题描述】:

我的操作系统版本:16299.309 所以 我下载 MS WebDriver,版本。 5.16299 发布:16299,来自https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

我在 C# 中的 SetEdgeDriver() 方法:

private IWebDriver SetEdgeDriver()
    {
        try
        {
            var path = @"C:\FolderWhereMSWebDriverExeFile ";
            var option = new EdgeOptions();

            option.PageLoadStrategy = PageLoadStrategy.Normal;                
            return new EdgeDriver(path, option);
        }
        catch (Exception)
        {                
            throw;
        }
    }

执行单元测试时,Edge 浏览器会短暂打开,然后关闭并显示错误消息“Unexpected error. Unknown error
测试只是去谷歌搜索网站,并且在 Chrome 上运行良好。
我遵循了这个:Edge browser crashing after initial watir-webdriver launch 但没有运气。请指教。

【问题讨论】:

    标签: c# webdriver


    【解决方案1】:

    你可以尝试不同的构造函数:

    IWebDriver wrappedWebDriver = new EdgeDriver(new EdgeOptions());
    

    这对我有用。无需指定文件夹。另外,认为正常的搜索模式是默认的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-05
      相关资源
      最近更新 更多