Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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.
Posted
Updated 1-May-18 7:57am

1 solution

That website itself is running and does provide a response, although an error message but it does work. Please check that you are not running this program behind a firewall or a network isolated environment. And yes, the IP address is the underlying IP address for your hostname (the one you are passing the constructor).

Also, I am not sure of what goes on behind that object—please check the documentation to see where else is the request being made as we cannot check that for you, from here. :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900