title: how to set up edgedriver correctly? getting the following error
body: <p>I'm using NUnit and Selenium in C# to build a framework which contains running multiple testcases on several browsers. Microsoft Edge is also supported in this case. When I set up my tests chrome and firefox run correctly but edge gives the following error:</p>
  
  <blockquote>
    <p>OpenQA.Selenium.WebDriverException : A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL <a href="http://localhost:55992/session" rel="nofollow noreferrer">http://localhost:55992/session</a>. The status of the exception was ReceiveFailure, and the message was: The underlying connection was closed: An unexpected error occurred on a receive.
      ----> System.Net.WebException : The underlying connection was closed: An unexpected error occurred on a receive.
      ----> System.IO.IOException : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
      ----> System.Net.Sockets.SocketException : An existing connection was forcibly closed by the remote host
    [2018. 06. 17. 17:08:22 Warning]    at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
       at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
       at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
       at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
       at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
       at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
       at OpenQA.Selenium.Edge.EdgeDriver..ctor(EdgeOptions options)
       at OpenQA.Selenium.Edge.EdgeDriver..ctor()
       at SeleniumNUnit.Tests.WebDriverFactory.EdgeDriver() in C:\SeleniumNUnit - Copy\SeleniumNUnit.Tests\Class1.cs:line 70
       at SeleniumNUnit.Tests.WebDriverFactory.WebDriver(BrowserType type) in C:\SeleniumNUnit - Copy\SeleniumNUnit.Tests\Class1.cs:line 50
       at SeleniumNUnit.Tests.WebDriverFactory..ctor(BrowserType type) in C:\SeleniumNUnit - Copy\SeleniumNUnit.Tests\Class1.cs:line 24
       at SeleniumNUnit.DemoTest..ctor(BrowserType browser) in C:\SeleniumNUnit - Copy\SeleniumNUnit\Class1.cs:line 12
    --WebException
       at System.Net.HttpWebRequest.GetResponse()
       at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
    --IOException
       at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
    --SocketException
       at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
       at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)</p>
  </blockquote>
  
  <p>I have tried to look up this specific error and the closest I got was that remote driver tries to send an HTTP request which in this case fails. Since Chrome and FF runs correctly I have no idea what goes wrong with Edge.</p>
  
  <p>WebDriverFactory:</p>
  
  <pre><code>using NUnit.Framework;
  using OpenQA.Selenium;
  using OpenQA.Selenium.Chrome;
  using OpenQA.Selenium.Firefox;
  using OpenQA.Selenium.IE;
  using WebDriverManager;
  using WebDriverManager.DriverConfigs.Impl;
  using System.IO;
  using OpenQA.Selenium.Edge;
  using System;
  
  namespace SeleniumNUnit.Tests
  {
      /// &lt;summary&gt;
      /// A static factory object for creating WebDriver instances
      /// &lt;/summary&gt;
      public class WebDriverFactory
      {
          public static string path = "C:\\Drivers\\";
          public IWebDriver Driver;
  
      protected WebDriverFactory(BrowserType type)
      {
          Driver = WebDriver(type);
      }
  
      [OneTimeTearDown]
      public void TestFixtureTearnDown()
      {
          Driver.Quit();
      }
  
      /// &lt;summary&gt;
      /// Types of browser available for proxy examples.
      /// &lt;/summary&gt;
      public enum BrowserType
      {
          IE,
          Chrome,
          Firefox,
      }
  
      public static IWebDriver WebDriver(BrowserType type)
      {
          IWebDriver driver = null;
  
          switch (type)
          {
              case BrowserType.IE:
                  driver = EdgeDriver();
                  break;
              case BrowserType.Firefox:
                  driver = FirefoxDriver();
                  break;
              case BrowserType.Chrome:
                  driver = ChromeDriver();
                  break;
          }
  
          return driver;
      }
  
      /// &lt;summary&gt;
      /// Creates Internet Explorer Driver instance.
      /// &lt;/summary&gt;
      /// &lt;returns&gt;A new instance of IEDriverServer&lt;/returns&gt;
      private static IWebDriver EdgeDriver()
      {
          new DriverManager().SetUpDriver("https://download.microsoft.com/download/F/8/A/F8AF50AB-3C3A-4BC4-8773-DC27B32988DD/MicrosoftWebDriver.exe", Path.Combine(path, "MicrosoftWebDriver.exe"), "MicrosoftWebDriver.exe");
          IWebDriver driver = new EdgeDriver();   
          return driver;
      }
  
      /// &lt;summary&gt;
      /// Creates Firefox Driver instance.
      /// &lt;/summary&gt;
      /// &lt;returns&gt;A new instance of Firefox Driver&lt;/returns&gt;
      private static IWebDriver FirefoxDriver()
      {
          new DriverManager().SetUpDriver(new FirefoxConfig());
          FirefoxOptions options = new FirefoxOptions();
          IWebDriver driver = new FirefoxDriver(options);
          return driver;
      }
  
  
      /// &lt;summary&gt;
      /// Creates Chrome Driver instance.
      /// &lt;/summary&gt;
      /// &lt;returns&gt;A new instance of Chrome Driver&lt;/returns&gt;
      private static IWebDriver ChromeDriver()
      {
          new DriverManager().SetUpDriver("https://chromedriver.storage.googleapis.com/2.40/chromedriver_win32.zip", Path.Combine(path, "chromedriver.exe"), "chromedriver.exe");
          ChromeOptions chromeOptions = new ChromeOptions();
          IWebDriver driver = new ChromeDriver(chromeOptions);
          return driver;
      }
  
  
  }
  }
  </code></pre>
  
  <p>TestCode:</p>
  
  <pre><code>using System;
  using NUnit.Framework;
  namespace SeleniumNUnit
  {
      [TestFixture(SeleniumNUnit.Tests.WebDriverFactory.BrowserType.Chrome)]
      [TestFixture(SeleniumNUnit.Tests.WebDriverFactory.BrowserType.Firefox)]
      [TestFixture(SeleniumNUnit.Tests.WebDriverFactory.BrowserType.IE)]
      public class DemoTest : SeleniumNUnit.Tests.WebDriverFactory
      {
          public DemoTest(SeleniumNUnit.Tests.WebDriverFactory.BrowserType browser)
          : base(browser)
      {
  
      }
  
      [OneTimeSetUp]
      public void SetUpEnvironment()
      {
          Driver.Navigate().GoToUrl("http://google.com");
  
      }
  
      [Test]
      public void validateTitle()
      {
          Assert.That(Driver.Title.Contains("Google"));
      }
  
      [OneTimeTearDown]
      public void tearDown()
      {
          Driver.Quit();
          Driver.Dispose();
      }
  }
  }
  </code></pre>