0

I am trying to launch Microsoft Edge Chromium browser using selenium. Microsoft Edge chromium Version: Version 79.0.309.65 (Official Build) (64-bit) Downloading driver file from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

Using this code to for the same but it is giving unreachable browser Exception and not working.

1.System.setProperty("webdriver.edge.driver", "C:\\Program Files (x86)\\Microsoft\\Edge Beta\\Application\\msedgedriver.exe");
EdgeOptions options = new EdgeOptions();
BROWSER=properties.getProperty("BrowserName");
options.setCapability(BROWSER, false);
//DesiredCapabilities  m_capability = DesiredCapabilities.edge();
driver= new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), options);
2.DesiredCapabilities  m_capability = DesiredCapabilities.chrome();
BROWSER=properties.getProperty("BrowserName");`enter code here`
m_capability.setCapability( BROWSER, "chrome" );
driver = new ChromeDriver();
System.setProperty("webdriver.chrome.driver",
                   "C:\\edgedriver_win64-1\\msedgedriver.exe");
pranali
  • 1
  • 1
  • 3
  • I am very curious if the new Edge-Chromium (january 15, 2020 or later) is able to be executed headless. Does anyone know? If so, i want to make a docker image to run it. – djangofan Jan 16 '20 at 22:54

2 Answers2

0

It is looking like compatibility issue. You can upgrade or downgrade your msedgedriver driver version to make it work.

I will recommend you to use WebDriverManager

WebDriverManager allows to automate the management of the binary drivers (e.g. chromedriver, geckodriver, etc.) required by Selenium WebDriver.

maven dependency

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.8.0</version>
    <scope>test</scope>
</dependency>

Once we have included this dependency, you can let WebDriverManager to manage the WebDriver binaries for you. Now you can set driver instance for Edge.

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();
        }
    }
Muzzamil
  • 2,823
  • 2
  • 11
  • 23
0
public void testservice(){  
    EdgeOptions opt= new EdgeOptions();
    opt.setHeadless();
    WebDriver driver= new EdgeDriver(opt);

}