简体   繁体   中英

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). 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. 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.

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.

HOWEVER, I then tried the 32 bit driver and it worked as expected...

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

driver = new EdgeDriver();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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