0

I am facing issue while launching my selenium script for edge browser. I followed below steps- Pre-Condition- I had Edge Legacy-Version 40 already installed on my system 1. Installed Edge Chromium Version LATEST-83... 2. Ran the automation selenide script on edge browser, it downloaded and used web driver version 83.... 3. Our frameowrk is built like that it downloads the latest webDriver version at run time from github.bonagracia 4. Edge Legacy was replaced by Edge Chromium post installation and I could not access Edge Legacy 5. Due to some manual evaluation on my system, had to use Edge legacy so un-installed Microsoft Edge Chromium, but could not proceed ahead much, because there was some configuration change to be done at system level 6. Now, re-installed Microsoft edge chromium, but post re-installation I can access both Edge Legacy & Edge Chromium separately. 7. The automation scripts is now taking edge legacy-Version 40.... as the browser instead of edge chromium-Version 83.0.. & downloading this version from github.bonagracia.

Alternative- Tried to disable the edge legacy in system properties, as cannot uninstall this software, because it is by default installed with Windows 10, but still that does not work. Selenide script is still downloading edge legacy web driver during runtime instead of edge chromium.

How can I ensure that my Edge legacy is disabled post installation of edge chromium and automation script uses the web driver manager for edge chromium rather than edge legacy.

Please suggest on this.

Shreya
  • 1
  • 2

1 Answers1

0

From your description, it seems that you will use the legacy version Edge and Microsoft Edge (Chromium version 83) version on the same machine. In this scenario, you could try to set the Edge driver directory path and the Edge browser's Binary Location when using selenium web driver.

To use the Legacy version Edge browser with Selenium web driver.

First, download the correct Microsoft WebDriver version. Then, refer to the following code to assign the webDriver directory path.

        // the edge driver directory path: MicrosoftWebDriver.exe
        //var driverpath = @"C:\Windows\System32";
        var driverpath = @"C:\Windows\SysWOW64";
        //var driverpath = @"C:\Windows\WinSxS\wow64_microsoft-webdriver-server-components_31bf3856ad364e35_10.0.18362.1_none_cf827c8a6da82156";
        //var driverpath = @"C:\Windows\WinSxS\amd64_microsoft-webdriver-server-components_31bf3856ad364e35_10.0.18362.1_none_c52dd23839475f5b";

        using (var driver = new EdgeDriver(driverpath))
        { 
            // Navigate to Bing
            driver.Url = "https://www.bing.com/";

            // Find the search box and query for webdriver
            var element = driver.FindElementById("sb_form_q");

            element.SendKeys("webdriver");
            element.SendKeys(Keys.Enter);
            driver.Quit();
        }

To use the Microsoft Edge with Microsoft Edge webDriver.

First, download the correct Microsoft WebDriver version, then refer to the following code assign the Edge webDriver directory path the binary location.

        #pragma warning disable IDE0017 // Simplify object initialization
        EdgeOptions edgeOptions = new EdgeOptions();
        edgeOptions.UseChromium = true;
        #pragma warning restore IDE0017 // Simplify object initialization
        edgeOptions.BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe";

        var msedgedriverDir = @"E:\webdriver\edgedriver_win64_84_0_502\edgedriver_win64"; //msedgedriver.exe 
        var driver = new EdgeDriver(msedgedriverDir,edgeOptions);
        driver.Navigate().GoToUrl("https://www.google.com");
        Thread.Sleep(2000);
        driver.Close();

[Note] Please remember to change the webdriver path and binary location to your owns. And in above sample, I'm using the C# selenium 4.0.0-alpha05 version.

Besides, here are some related articles might be is useful for you.

Access Microsoft Edge Legacy after installing the new version of Microsoft Edge

Use Microsoft Edge (Chromium) with WebDriver

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30