title: Attempting to run multiple Selenium Webdriver tests using Nunit fails
body: <p>I was wondering if anyone could help me here. I'm using selenium Webdriver with C# and Nunit, and when I'm attempting to run multiple tests, I'm getting the following error:</p>
  
  <blockquote>
    <p>OpenQA.Selenium.WebDriverException : Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:7055
       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)</p>
  </blockquote>
  
  <p>When I run these tests as individuals they are running and passing fine.</p>
  
  <p>Any help or pointer would be great.</p>
  
  <p>Below is a sample of my Code and my driver class</p>
  
  <blockquote>
    <p>Driver Class</p>
  </blockquote>
  
  <pre><code>using System;
  using System.Configuration;
  using OpenQA.Selenium;
  using OpenQA.Selenium.Chrome;
  using OpenQA.Selenium.Firefox;
  using OpenQA.Selenium.IE;
  
  namespace SMT.Web.FunctionalTests.Drivers
  {
     public class Driver
  {
      private static IWebDriver _driver;
  
      protected static IWebDriver GetWebDriver
      {
          get
          {
              if (_driver == null)
              {
                  string driverConfig = ConfigurationManager.AppSettings["browser"];
                  if (!String.IsNullOrEmpty(driverConfig))
                  {
                      switch (ConfigurationManager.AppSettings["browser"])
                      {
                          case "Chrome":
                              _driver = new ChromeDriver();
                              ConfigureDriver();
                              break;
                          case "Firefox":
                              _driver = new FirefoxDriver();
                              ConfigureDriver();
                              break;
                          case "IE":
                              _driver = new InternetExplorerDriver();
                              ConfigureDriver();
                              break;
                          default:
                              Console.WriteLine("App.config key error");
                              Console.WriteLine("Defaulting to FireFox");
                              _driver = new FirefoxDriver();
                              ConfigureDriver();
                              break;
                      }
                  }
                  else
                  {
                      Console.WriteLine("* * * * DEFAULT MODE * * * *");
                      Console.WriteLine("Defaulting to Firefox");
                      _driver = new FirefoxDriver();
                      ConfigureDriver();
  
                  }
              }
              return _driver;
          }
      }
  
      internal static void ConfigureDriver(string page = "")
      {
          string url = ConfigurationManager.AppSettings["URL"];
          _driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 30));
          _driver.Manage().Cookies.DeleteAllCookies();
          _driver.Manage().Window.Maximize();
          _driver.Navigate().GoToUrl(string.Concat(url, page));
      }
  
      public static void Close()
      {
          _driver.Close();
      }
  }
  
  }
  </code></pre>
  
  <blockquote>
    <p>Test Class</p>
  </blockquote>
  
  <pre><code>public class LoginRegressionTests : Driver
  {
      public static IWebDriver WebDriver { get; set; }
      public AjaxHelpers AjaxHelpers;
      public DatabaseHelpers DatabaseHelpers;
  
      [SetUp]
      public void Setup()
      {
          DatabaseHelpers = new DatabaseHelpers();
          DatabaseHelpers.DatabaseSetUpClearDown();
          WebDriver = GetWebDriver;
          AjaxHelpers = new AjaxHelpers(WebDriver);
      }
  
      [TearDown]
      public void Teardown()
      {
          WebDriver.Close();
      }
  
      [Test]
      public void LoginWithIncorrectUserNamePasswordTest()
      {
          // Create an Instance of Header Banner Page Object
          var headerBannerPage = new HeaderBannerPage(WebDriver);
          headerBannerPage.ClickSigninLink();
  
  
          // Create an Instance of Login Page Object
          var loginPage = new LoginPage(WebDriver);
          loginPage.EnterCustomerUsername("someoneemail@email.com");
          loginPage.EnterCustomerPassword("*&amp;^%£$£");
          loginPage.ClickLoginCustomerButton();
  
          AjaxHelpers.WaitForAjax();
  
          String usernameRequiredBorderBottom = WebDriver.FindElement(By.CssSelector("#login-username")).GetCssValue("border-bottom-color");
          String usernameRequiredBorderLeft = WebDriver.FindElement(By.CssSelector("#login-username")).GetCssValue("border-left-color");
          String usernameRequiredBorderRight = WebDriver.FindElement(By.CssSelector("#login-username")).GetCssValue("border-right-color");
          String usernameRequiredBorderTop = WebDriver.FindElement(By.CssSelector("#login-username")).GetCssValue("border-top-color");
          Assert.AreEqual(usernameRequiredBorderBottom, "rgba(181, 79, 80, 1)");
          Assert.AreEqual(usernameRequiredBorderLeft, "rgba(181, 79, 80, 1)");
          Assert.AreEqual(usernameRequiredBorderRight, "rgba(181, 79, 80, 1)");
          Assert.AreEqual(usernameRequiredBorderTop, "rgba(181, 79, 80, 1)");
  
  
          String passwordrequiredBorderBottom = WebDriver.FindElement(By.CssSelector("#login-password")).GetCssValue("border-bottom-color");
          String passwordrequiredBorderLeft = WebDriver.FindElement(By.CssSelector("#login-password")).GetCssValue("border-left-color");
          String passwordrequiredBorderRight = WebDriver.FindElement(By.CssSelector("#login-password")).GetCssValue("border-right-color");
          String passwordrequiredBorderTop = WebDriver.FindElement(By.CssSelector("#login-password")).GetCssValue("border-top-color");
          Assert.AreEqual(passwordrequiredBorderBottom, "rgba(181, 79, 80, 1)");
          Assert.AreEqual(passwordrequiredBorderLeft, "rgba(181, 79, 80, 1)");
          Assert.AreEqual(passwordrequiredBorderRight, "rgba(181, 79, 80, 1)");
          Assert.AreEqual(passwordrequiredBorderTop, "rgba(181, 79, 80, 1)");
  
      }
  }
  </code></pre>