自动化测试铬边缘

Automation test chromium edge

我尝试 运行 使用 chromium edge 版本 79.0.309.56 进行 selenium 测试。 这是测试代码,但出现错误

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: unrecognized Chrome version: Edg/79.0.309.56

密码是:

System.setProperty("webdriver.edge.driver", "<path to driver>\msedgedriver.exe");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary("<path to browser>\msedge.exe");
DesiredCapabilities m_capability = DesiredCapabilities.edge();
m_capability.merge(chromeOptions);
EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
try{
    RemoteWebDriver driver = new RemoteWebDriver(new URL("http://<ip>:80/wd/hub"), m_capability);
    driver.get("http://www.google.com");
} catch (MalformedURLException e) {
    e.printStackTrace();
}

我没有找到解决此错误的方法。 谢谢

您使用的是哪个版本的 selenium 服务器和 Microsoft Edge (Chromium) 驱动程序?我使用 selenium-server-standalone-3.141.59.jarMicrosoft Edge (Chromium) 驱动程序 79.0.309.43 并且代码可以工作很好地自动化 Microsoft Edge (Chromium) 79.0.309.56.

如何启动集线器和节点?你可以参考我下面的步骤:

启动集线器: 使用命令提示符,导航到 selenium 服务器的路径,然后在命令提示符下键入:

java -jar selenium-server-standalone-3.141.59.jar -role hub -maxSession 10 -port 4444

启动一个节点: 导航到同一路径并在命令提示符下键入:

java -Dwebdriver.chrome.driver="your\path\to\webdriver\msedgedriver.exe" -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://<your_ip>:4444/grid/register -port 3333

成功启动后,运行 您提供的代码和 Capabilities 将在命令提示符中显示如下:

INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "chrome",
  "goog:chromeOptions": {
    "args": [
    ],
    "binary": "C:\Program Files (x86)\Microsoft\Edge Beta\Application\msedge.exe",
    "extensions": [
    ]
  },
  "platform": "WINDOWS",
  "version": ""
}

参考:Selenium Grid Tutorial: Hub & Node (with Example)