I am getting following error on creating instance of RemoteWebDriver
driver = new RemoteWebDriver(new Uri("http://hub-cloud.browserstack.com/wd/hub/"), capability);
Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond XXX.XXX.XXX.XXX:Port
What I have tried:
var browserStackLocal = new Local();
var localArgs = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("key", "XXXXXXXXXXXXXXXXXXXXX"),
new KeyValuePair<string, string>("force", "true"),
new KeyValuePair<string, string>("binarypath", "/temp"),
new KeyValuePair<string, string>("logfile", "/temp/logs.txt"),
new KeyValuePair<string, string>("v", "true"),
new KeyValuePair<string, string>("proxyHost", "HostName"),
new KeyValuePair<string, string>("proxyPort", "PortNumber"),
new KeyValuePair<string, string>("proxyUser", "Username"),
new KeyValuePair<string, string>("proxyPass", "Password")
};
browserStackLocal.start(localArgs);
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("browser", "Chrome");
capability.SetCapability("browser_version", "62.0");
capability.SetCapability("os", "Windows");
capability.SetCapability("os_version", "7");
capability.SetCapability("resolution", "1024x768");
capability.SetCapability("browserstack.local", "true");
capability.SetCapability("browserstack.debug", "true");
capability.SetCapability("browserstack.user", "UserXXXXXX");
capability.SetCapability("browserstack.key", "KeyXXXXXX");
driver = new RemoteWebDriver(new Uri("http://hub-cloud.browserstack.com/wd/hub/"), capability);
driver.Navigate().GoToUrl("http://google.co.uk");
Option 1) I am able to establish a connection using the following code:
browserStackLocal.start(localArgs);
But, still getting "Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 185.44.131.194:80", in the following code:
driver = new RemoteWebDriver(new Uri("http://hub-cloud.browserstack.com/wd/hub/"), capability);
Option 2) Also tried the following command
BrowserStackLocal.exe --key XXXXXX --proxy-host Host --proxy-port Port --proxy-user Username --proxy-pass Password --force-local --force-proxy
And adding the following code
capability.SetCapability("browserstack.local", "true");
If anyone faced this issue, please share your experience and solution.