public static IWebDriver UserMultiUserSignIn (IWebDriver driver, string port, string hostName, string password, string Username)
    string name = Dns.GetHostName();
    ChromeOptions Options = new ChromeOptions();
    Options.AddAdditionalCapability(Username, "USERNAME");
    Options.AddAdditionalCapability(password, "ACCESS_KEY");
    driver = new RemoteWebDriver(new Uri("http://"+hostName+":"+port+ "/wd/hub"), Options.ToCapabilities());            

    return driver;

public static void RemoteServerLogin ()
    string EMAUserName = System.Configuration.ConfigurationManager.AppSettings.Get("EMAUserName");
    string Password = System.Configuration.ConfigurationManager.AppSettings.Get("EMAPassword");
    string Port = System.Configuration.ConfigurationManager.AppSettings.Get("Port");
    string HostName = System.Configuration.ConfigurationManager.AppSettings.Get("Hostname");

    UserMultiUserSignIn(driver, Port, HostName, Password, EMAUserName);


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 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo) at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)'

  • How do you start your webdriver? – wec Oct 30 at 14:15

With chrome the setup is a little different. I'd need more info to help. Were you able to connect before and it recently stopped? If so I would say to make sure you have the most up to date driver. Is this the initial setup?

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.