让 Atata 使用 Microsoft Edge (Chromium)

问题描述

看来 Atata 附带的 Selenium 版本不支持 EdgeOption "UseChromium",当我尝试使用 Edge 驱动程序时,测试运行失败,除非我在 bin\Debug\netcoreapp2.1 中重命名驱动程序\drivers\edge\91.0.864.41 文件夹从“msedgedriver.exe”到“MicrosoftWebDriver.exe”,这让我相信它正在尝试运行旧的非铬 Edge - 有什么方法可以让它工作吗?

解决方法

为了在 Atata 中使用 Chromium Edge:

  1. Selenium.WebDriver 软件包更新为 4.0.0-beta2 版本。

  2. 将 Atata 配置更改为:

    AtataContext.GlobalConfiguration
        .UseDriver(() =>
        {
            EdgeOptions options = new EdgeOptions
            {
                UseChromium = true
            };
    
            // Headless options:
            //options.AddArguments("headless","disable-gpu","window-size=1024,768");
    
            return new EdgeDriver(options);
        })
    

Atata Samples / Using Headless Edge 示例也可能有所帮助。