Unable to connect to Remote Server using Selenium Chrome RemoteWebDriver



  • 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);
    }
    

    Exception:

    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:9515 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)'



  • 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?



Suggested Topics