java - 无法在边缘 webDriver 上运行我的 Selenium 测试

标签 java macos selenium selenium-webdriver microsoft-edge

我使用的是 macOS,我在上面安装了 Edge Webdriver,并在我的 selenium 框架上配置了它的路径

但是我收到了这个错误:

org.openqa.selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'MacBook-Pro-de-Sabrine-2.local', ip: 'fe80:0:0:0:4c2:e6bc:d2ff:348c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_191'
Driver info: driver.version: EdgeDriver

最佳答案

所以您使用的是 MAC。问题是您的系统上需要安装浏览器才能运行它。 因此,如果您以某种方式安装了它,请使用以下代码:

代码:

System.setProperty("webdriver.edge.driver","/YOUR_PATH");
WebDriver driver = new EdgeDriver();
driver.get("http://www.google.com"); 

或者

System.setProperty("webdriver.edge.driver","YOUR_PATH");
ChromeOptions chromeOptions  = new ChromeOptions();
chromeOptions.setBinary("/YOUR_PATH");
EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
WebDriver driver = new EdgeDriver(edgeOptions);
driver.get("http://www.google.com"); 

关于java - 无法在边缘 webDriver 上运行我的 Selenium 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57769005/

相关文章:

java - 如何在 Java 中填充数组?

vba - 使用 VBA 和 Selenium 驱动网站,pt2

java - 如何在测试启动之前修改 testNG DataProvider 数组对象(在 Saucelabs 中命名测试)

java - PageObjectModel 与 ExcelBased Selenium 框架

java - swagger-codegen 客户端 : How to include jackson annotations on models

java - 清理混合类型的 <script> 标签

java - 无法从 JTable 中的列获取正确的值

macos - 使用 newsyslog 轮换日志文件,但前提是它们具有一定大小

c++ - Mac OS X 上的 Emacs 24 和 GDB 6.3

objective-c - Mac cocoa - 我如何检测触控板滚动手势?