title: C# + VisualStudio + Multiple WebDriver instances = SocketExceptions
body: <p>The WebDriver-based tests for our web application requires multiple browser windows open at once: one opens the consumer-facing portal, the other opens the administrator portal (to ensure changes in one are seen in the other).  This is done by creating two seperate WebDriver objects: eg</p>
  
  <pre><code>IWebDriver driver1 = DriverFactory.NewChromeDriver();
  IWebDriver driver2 = DriverFactory.NewChromeDriver();
  </code></pre>
  
  <p>The test can access both WebDrivers as desired.  Our tests are specified in SpecFlow and implemented as MSTest cases.  The tests are developed in VisualStudio 2013 Premium, and the drivers simply use the local machine's ChromeDriver instance.  All well and good.</p>
  
  <p>When a test performs some actions in Driver2 (say, logging in) and then moves back to Driver1, I end up with a SocketException being thrown because localhost actively refused the connection.  Windows Firewall has been told to permit the application on all ports, the factory sets up the proxy correctly.  The precise stack trace is:</p>
  
  <pre><code>System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:50467
  Result StackTrace:  
  at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
  at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Exception&amp; exception)
  </code></pre>
  
  <p>Firefox opens one browser and then gives up.  IE can't even FIND the browser when multiple windows are open.</p>
  
  <p>(I never had this problem until I installed the latest update for VS2013....)</p>
  
  <p>Any ideas?  Thanks team.</p>