简体   繁体   English

Java - 无法获得使用 selenium 的最新 Edge/Chromium 版本

[英]Java - Unable to get the latest Edge/Chromium release working with selenium

We have a set of Selenium auto tests that work with Chrome/Firefox/Edge (pre Chromium Edge).我们有一组适用于 Chrome/Firefox/Edge(前 Chromium Edge)的 Selenium 自动测试。 We would like to be able to run the set test suite against the latest edge.我们希望能够针对最新的边缘运行设置测试套件。

Selenium (Java) - 4.0.0-alpha-4
Edge - 79.0.309.71

I've tried various combinations of the below setup我尝试了以下设置的各种组合

System.setProperty("webdriver.edge.edgehtml", "false");
System.setProperty("webdriver.edge.driver", "path\to\msedgedriver.exe");
System.setProperty("webdriver.chrome.driver", "path\to\msedgedriver.exe");

EdgeOptions edgeOptions = new EdgeOptions();
edgeOptions.setBinary("path\to\msedgedriver.exe");

driver = new EdgeDriver();

Each time gives the following error每次都给出以下错误

org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '4.0.0-alpha-4', revision: 'c2d955b49e'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_162'
Driver info: driver.version: EdgeDriver

Has anyone got this working?有没有人让这个工作?

I test with Microsoft Edge(Chromium) Beta version 79.0.309.43 and the same version of Microsoft Edge(Chromium) WebDriver (You could download the webdriver from here ) and it works.我使用 Microsoft Edge(Chromium) Beta 版本 79.0.309.43 和相同版本的 Microsoft Edge(Chromium) WebDriver(您可以从此处下载 webdriver)进行测试,并且可以正常工作。 You could refer to the code below and change the path to your owns:您可以参考下面的代码并更改您自己的路径:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions; 
import org.openqa.selenium.edge.EdgeOptions;


public class Edgeauto {
    public static void main(String[] args) { 
        System.setProperty("webdriver.chrome.driver", "your\\path\\to\\edge\\webdriver\\msedgedriver.exe");
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setBinary("C:\\Program Files (x86)\\Microsoft\\Edge Beta\\Application\\msedge.exe");
        EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
        WebDriver driver = new ChromeDriver(edgeOptions);
        driver.get("https://www.google.com/");
    }
}

Also please remember to have the location of Edge Beta and msedgedriver.exe on your PATH.另外请记住在您的路径上有 Edge Beta 和 msedgedriver.exe 的位置。

Not sure if this will be relevant for everyone, but I have fixed it myself by doing the following...不确定这是否与每个人都相关,但我通过执行以下操作自己修复了它......

The version of edge is Version 79.0.309.71 (Official build) (64-bit) and i assumed the correct driver was the the 64 bit driver from the microsoft site. edge 的版本是 Version 79.0.309.71 (Official build) (64-bit),我假设正确的驱动程序是来自微软站点的 64 位驱动程序。

HOWEVER, I then tried the 32 bit driver and it worked as expected...但是,然后我尝试了 32 位驱动程序,它按预期工作......

System.setProperty("webdriver.edge.driver", "path\to\msedgedriver_32.exe");

driver = new EdgeDriver();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM