public static IWebDriver UserMultiUserSignIn (IWebDriver driver, string port, string hostName, string password, string Username)
{
string title = Dns.GetHostName();
ChromeOptions Choices = new ChromeOptions();
Choices.AddAdditionalCapability(Username, "USERNAME");
Choices.AddAdditionalCapability(password, "ACCESS_KEY");
driver = new RemoteWebDriver(new Uri("http://"+hostName+":"+port+ "/wd/hub"), Choices.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: ‘Surprising error.
System.Internet.WebException: Unable to hook up with the distant server —>
System.Internet.Sockets.SocketException: No connection might be made
as a result of the goal machine actively refused it 127.0.0.1:9515 at
System.Internet.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress) at
System.Internet.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
Socket s4, Socket s6, Socket& socket, IPAddress& tackle,
ConnectSocketState state, IAsyncResult asyncResult, Exception&
exception) — Finish of internal exception stack hint — at
System.Internet.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Internet.HttpWebRequest.GetRequestStream() at
OpenQA.Selenium.Distant.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo
requestInfo) at
OpenQA.Selenium.Distant.HttpCommandExecutor.Execute(Command
commandToExecute) at
OpenQA.Selenium.Distant.RemoteWebDriver.Execute(String
driverCommandToExecute, Dictionary`2 parameters)’