10

I'm trying to run a Selenium test with Java and Edge Dev (based on Chromium). I have downloaded the driver binary (msedgedriver.exe, 64-bits in my case) from here.

The version of my Edge Dev installed on Windows 10 is 76.0.152.0 (Official build dev 64-bit):

enter image description here

Then, I have the following JUnit 4 test:

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.edge.EdgeDriver;

public class EdgeDevTest {

    private WebDriver driver;

    @BeforeClass
    public static void setupClass() {
        System.setProperty("webdriver.edge.driver",
                "C:\\Users\\boni\\Downloads\\msedgedriver.exe");
    }

    @Before
    public void setupTest() {
        driver = new EdgeDriver();
    }

    @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"));
    }

}

... which fails as follows:

org.openqa.selenium.SessionNotCreatedException: session not created: No matching capabilities found
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'LAPTOP-T9O4060I', ip: '192.168.99.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111'
Driver info: driver.version: EdgeDriver
remote stacktrace: Backtrace:
    Ordinal0 [0x00007FF7894D9442+1741890]
    Ordinal0 [0x00007FF78943D692+1103506]
    Ordinal0 [0x00007FF7893C828F+623247]
    Ordinal0 [0x00007FF78936932A+234282]
    Ordinal0 [0x00007FF7893699A3+235939]
    Ordinal0 [0x00007FF78936794F+227663]
    Ordinal0 [0x00007FF789349BC7+105415]
    Ordinal0 [0x00007FF78934B2CE+111310]
    GetHandleVerifier [0x00007FF78966D249+1471113]
    GetHandleVerifier [0x00007FF78959C525+615781]
    GetHandleVerifier [0x00007FF78959C2C1+615169]
    Ordinal0 [0x00007FF7894E91CC+1806796]
    GetHandleVerifier [0x00007FF78959CC56+617622]
    Ordinal0 [0x00007FF78945748E+1209486]
    Ordinal0 [0x00007FF78946483C+1263676]
    Ordinal0 [0x00007FF7894636BD+1259197]
    BaseThreadInitThunk [0x00007FF86D337974+20]
    RtlUserThreadStart [0x00007FF86D7FA271+33]

Any idea?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Boni García
  • 4,618
  • 5
  • 28
  • 44
  • How , do you know that driver available is for new chromium version? I am under impression that drivers available are only for normal Edge versions , they have not released driver for chromium based edge yet . Isn't it so ? – Nilesh G May 12 '19 at 07:32
  • @NileshG They were released a few weeks ago. See the link in the op: "Microsoft Edge version supported: 75" – Jools May 14 '19 at 15:49

7 Answers7

5

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\
Jools
  • 839
  • 8
  • 22
  • looks like a workaround rather than a solution. How will you run chrome in this scenario?? – Leon Proskurov Sep 24 '20 at 07:59
  • If you're running against multiple browsers, you should probably be looking at running a grid. It that scenario it doesn't matter because the edge node would be independently started with its own property for the name of the driver. You can specify the node capabilities to be whatever you want, so could even select old or new Edge. I haven't had a look at the latest Selenium, but I think this workaround might now be unnecessary if you're willing to upgrade. https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium – Jools Sep 25 '20 at 08:32
  • In case that link goes down: "The Microsoft Edge team recommends Selenium 4.00-alpha05 or later, because it supports Microsoft Edge (Chromium)." – Jools Sep 25 '20 at 08:32
4

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"));
    }

}
Boni García
  • 4,618
  • 5
  • 28
  • 44
  • Was there more to your fix than what's here? I had almost this identical issue, and with this fix it still gives the "No matching capabilities" error. – ChicagoRedSox Jan 08 '20 at 20:48
  • 2
    Follow-up: the issue was this: https://stackoverflow.com/q/58590613/2136840. Manually setting `WebDriverManager.edgedriver().config().setEdgeDriverVersion("79.0.309.60")` fixed the problem for now. Driver 79.0.313.0 wasn't working with Edge 79. – ChicagoRedSox Jan 08 '20 at 21:23
2

I am using "chromium edge" Version 80.0.361.5 (Official build) dev (64-bit), I tried the way provided by Jools, but it didn't work for me.

I started the "selenium server" with option -Dwebdriver.chrome.driver="pathTo\msedgedriver.exe"

I added the folder containing Edge executable "msedge.exe" on the environment PATH

Then I ran the following code, but it failed

System.setProperty("webdriver.chrome.driver", "C:\\SeleniumPlus\\extra\\msedgedriver.exe");
DesiredCapabilities m_capability = DesiredCapabilities.chrome();
m_capability.setCapability(CapabilityType.BROWSER_NAME, BrowserType.CHROME);
WebDriver driver = new ChromeDriver(m_capability);

I tried another way and it worked for me:

I started the "selenium server" with option -Dwebdriver.edge.driver="pathTo\msedgedriver.exe"

I added the folder containing Edge executable "msedge.exe" on the environment PATH

System.setProperty("webdriver.edge.driver", "C:\\SeleniumPlus\\extra\\msedgedriver.exe");
DesiredCapabilities m_capability = DesiredCapabilities.edge();
WebDriver driver = new EdgeDriver(m_capability);

new EdgeDriver(m_capability); is deprecated, we can use the RemoteWebDriver instead as below:

driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), m_capability);
lei wang
  • 109
  • 1
  • 1
  • 9
1

EdgeDriver does not currently work on 'msedgedriver.exe'. There is a PR on Selenium to support that https://github.com/SeleniumHQ/selenium/pull/7164

One way to work around is to use ChromeDriver and rename 'msedgedriver.exe' to 'chromedriver.exe' to trick ChromeDriver into launching MSEdge.

1

Selenium Using C#. Please find below unit test project using C# for Edge Beta. Hope this helps someone!

You will need Edge Beta Driver and browser exe Link

using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;

namespace EdgeBetaProject
{
[TestClass]
public class UnitTest1
{
    [TestMethod]
    public void TestMethod1()
    {
        IWebDriver _driver=null;


            var driverService = ChromeDriverService.CreateDefaultService(@"Folder Path where driver is present", "msedgedriver.exe");
            var driverOptions = new ChromeOptions
            {
                BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Beta\Application\msedge.exe"
            };
            _driver = new ChromeDriver(driverService, driverOptions);
            _driver.Navigate().GoToUrl(@"https://www.google.com/");


            _driver.Quit();

    }
}
KR Akhil
  • 877
  • 3
  • 15
  • 32
0

Sup everyone,

I want to confirm that everything is working with the dev channel edge browser (Chromium based). You need to use the System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir").concat("\\drivers\\msedgedriver.exe"));

As you can see I'm getting the chrome webdriver properties using the new msedgedriver.exe executable.

private void initializeEdgeDriver() 
 {

    System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir").concat("\\drivers\\msedgedriver.exe"));
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.setBinary(
            "C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe");
    EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
    webDriver = new ChromeDriver(edgeOptions);
    webDriver.manage().window().maximize();
    webDriverWait = new WebDriverWait(webDriver, GLOBAL_TIMEOUT);
}

Hope this helps.

Android
  • 1,420
  • 4
  • 13
  • 23
0

For those using Edge chromium (Edge chromium browser V 81) in C#, this might help them get going

string edgeDriverPath = SolutionDirPath() + "\\edgedriver_win64";
string edgeBrowserPath = ProgramFilesx86() + "\\Microsoft\\Edge\\Application\\msedge.exe";

var service = EdgeDriverService.CreateChromiumService(@edgeDriverPath, "msedgedriver.exe");
service.UseVerboseLogging = true;

var optionsEdge = new EdgeOptions();
optionsEdge.UseChromium = true;
// ignore if any security related alerts
optionsEdge.AddArguments("--ignore-certificate-errors");
optionsEdge.BinaryLocation = @edgeBrowserPath;

driver = new EdgeDriver(service, optionsEdge);
Kal
  • 3
  • 3
  • does anyone know how to start in edge chromium in IE mode? is there a capability setting available? – anandhu Aug 23 '20 at 04:16