Reputation: 234
I'm testing a .Net exe web application on my local machine using Selenium web driver in Visual Studio. To view the web UI I need to open a firefox browser and connect to http://localhost:12345
When I run this code
driver.Navigate().GoToUrl("http://localhost:12345");
a browser opens but just sits blank. Then I eventually get this error in VS:
'OpenQA.Selenium.WebDriverException : Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055'
When I run the same test using Selenium IDE Firefox opens http://localhost:12345 correctly.
How do I get Firefox to open the localhost address I provide it in my C# code?
Upvotes: 1
Views: 3915
Reputation: 234
Thanks for taking the time to look at my question. I have managed to find a solution which I will post here for anyone who encounters the same problem.
In order to access localhost I used Selenium Standalone Server instead of Web Driver. These are the steps:
1- In class under [Setup] enter
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://localhost:12345/");
selenium.Start();
verificationErrors = new StringBuilder();
}
2- Download Selenium Standalone Server
4- Run Selenium Standalone Server using cmd java -jar selenium-server-standalone-version-number.jar
5- Run test in Visual Studio
And now it works.
Upvotes: 1