Selenium and Edge Dev (Chromium based)
Just to close this issue, based on the answer by Jools, I have updated my test (using the latest version of WebDriverManager) and now it is working:
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;
import io.github.bonigarcia.wdm.WebDriverManager;
public class EdgeDevTest {
private WebDriver driver;
@BeforeClass
public static void setupClass() {
WebDriverManager.edgedriver().setup();
}
@Before
public void setupTest() {
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary(
"C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe");
EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
driver = new EdgeDriver(edgeOptions);
}
@After
public void teardown() {
if (driver != null) {
driver.quit();
}
}
@Test
public void test() {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("JUnit 5 extension for Selenium"));
}
}
Just got it working. My setup is a little different from yours because I'm using a grid, but it should be fairly similar.
For me, when requesting a driver from the grid I use the chrome capabilities:
m_capability = DesiredCapabilities.chrome();
m_capability.setCapability( "browserName", "chrome" );
So in your case I guess you'll want this instead:
driver = new ChromeDriver();
When launching a node I specify the chrome driver to point to the edge driver (I have it on the PATH, so no need for absolute path)
java -Dwebdriver.chrome.driver=msedgedriver.exe ...
So in your case you'll want this instead:
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\boni\\Downloads\\msedgedriver.exe");
Another thing to remember is to have the location of Edge executable (see below) on your PATH
For Edge Dev you'll want to add:
C:\Program Files (x86)\Microsoft\Edge Dev\Application\
Or if you're using Canary, it's probably:
C:\Users\boni\AppData\Local\Microsoft\Edge SxS\Application\