java - org.openqa.selenium.WebDriverException : unknown error: cannot find MSEdge binary error using EdgeDriver and Selenium on Mac through Java

标签 java macos selenium selenium-webdriver selenium-edgedriver

我在使用 Selenium Remote Web 驱动程序在 MAC 上运行 MS Edge 测试时遇到问题。

我尝试为边缘二进制文件设置系统属性,如下所示:

dc = DesiredCapabilities.edge();
System.setProperty("webdriver.edge.driver", "/Users/username/Softwares/Work/jars/msedgedriver");
dc.setCapability("edge_binary","/Applications/Microsoft Edge Beta.app");

我检查了我安装的 msedge 驱动程序版本和 MS Edge 浏览器版本。 两者都是 - 80.0.361.48

这是 Selenium 节点上的日志:

020-02-11 18:06:37.533:INFO:osjshC.ROOT:qtp1800659519-12: org.openqa.selenium.remote.server.WebDriverServlet-59309333: Initialising WebDriverServlet 18:06:37.551 INFO - Found handler: org.openqa.selenium.remote.server.commandhandler.BeginSession@47c6497e 18:06:37.555 INFO - /session: Executing POST on /session (handler: BeginSession) 18:06:37.632 INFO - Capabilities are: Capabilities {MicrosoftEdge_binary: /Applications/Microsoft Edg..., browserName: MicrosoftEdge, platform: MAC, version: } 18:06:37.633 INFO - Capabilities {MicrosoftEdge_binary: /Applications/Microsoft Edg..., browserName: MicrosoftEdge, platform: MAC, version: } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.edge.EdgeDriverService) Starting MSEdgeDriver 80.0.361.48 (e1a3ff36578e440880567e6adcbeab38ec2956fa) on port 31883 Only local connections are allowed. Please protect ports used by MSEdgeDriver and related test frameworks to prevent access by malicious code.

运行代码时遇到的异常如下

org.openqa.selenium.WebDriverException: unknown error: cannot find MSEdge binary Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z' System info: host: '****-MacBook-Pro.local', ip: 'fe80:0:0:0:14d9:68c6:7d2c:87a%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.2', java.version: '1.8.0_152' Driver info: driver.version: unknown

最佳答案

此错误消息...

org.openqa.selenium.WebDriverException: unknown error: cannot find MSEdge binary 
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z' 
System info: host: '****-MacBook-Pro.local', ip: 'fe80:0:0:0:14d9:68c6:7d2c:87a%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.2', java.version: '1.8.0_152' 
Driver info: driver.version: unknown

...意味着程序无法在您的系统中找到 MSEdge 二进制文件。

您的主要问题是您使用的二进制文件版本之间不兼容,如下所示:

  • 尽管您使用的是兼容版本的 MS Edge Driver v80.0MS Edge Browser v80.0
  • 您的 Selenium 客户端版本是 2017-11-06T21:07:36.161Z3.7.1,几乎是 2.5 老了几岁。
  • 但是您的JDK版本1.8.0_152,这是相当古老的。

因此,JDK v8u152Selenium Client v'3.7.1MS Edge Driver v80.0MS Edge 浏览器 v80.0

<小时/>

解决方案

确保:

  • JDK 已升级到当前级别 JDK 8u241 .
  • Selenium 升级至当前级别 Version 3.141.59 .
  • 重新启动系统
  • 非root用户身份执行@Test

关于java - org.openqa.selenium.WebDriverException : unknown error: cannot find MSEdge binary error using EdgeDriver and Selenium on Mac through Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60169089/

相关文章:

selenium - 如何使用 xpath 查找带有可选子元素的元素?

javascript - 迭代中的 StaleElementReferenceError

JavaFX 8 DatePicker 样式

java - 干净的代码 - 避免对基于通用数据类型构建的集合进行显式类型转换

Mac OS X 上的 Docker 登录失败

OS X 10.8.5 上的 C++ math.h

Python webdriver : driver. get(URL) 无法在单元测试中打开 - 通过控制台工作

java - 如何使用 Java 8 在与 ifPresent 相同的条件下返回 orElseThrow?

java - 为什么数字字符不能用作目录名? ( java )

Swift:静态函数太多?