I'm trying to load the msedge chromium. encountering error.

Steps to recreate:

  1. Installed mschromium Beta and Dev versions.
  2. Installed the Nuget package "Install-Package Selenium.WebDriver -Version 4.0.0-alpha04"
  3. placed the msedgedriver.exe in location which I mentioned in the code.
  4. still code throwing error.

    public void Test1()
        // EdgeOptions() requires using OpenQA.Selenium.Edge
        // Construct EdgeOptions with is_legacy = false
        var edgeOptions = new OpenQA.Selenium.Edge.EdgeOptions(false);
        edgeOptions.BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe";
        var msedgedriverDir = @"E:\XXXXX\#######\YYYYYY\ZZZZZZ\MSEdgeChromium\bin\Debug";
        var msedgedriverExe = @"msedgedriver.exe";
        // Construct EdgeDriverService with is_legacy = false too
        var service = OpenQA.Selenium.Edge.EdgeDriverService.CreateDefaultService(msedgedriverDir, msedgedriverExe, false);
        service.EnableVerboseLogging = true;
        var driver = new OpenQA.Selenium.Edge.EdgeDriver(service, edgeOptions);

ErrorDetails: System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Security.Permissions, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'


If you added the msedgedriver.exe to your project manually you also need to set the Copy to Output Directory property of the file.

Because non-code files are default not placed in the build directory bin\Debug. Double check the driver is indeed copied to the directory.

Instead of hardcoding the path to the output directory you could try:

var msedgedriverDir = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

See: https://social.technet.microsoft.com/wiki/contents/articles/53248.visual-studio-copying-files-to-debug-or-release-folder.aspx

  • Its working Bro. Thank you so much – Thiyagarajan Mar 3 '20 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.