0
votes

Upon doing this code:

using OpenQA.Selenium.Remote;
...

var driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox());

// To automate...
// driver.Navigate().GoToUrl("http://www.example.com/");

I'm getting this error:

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:4444

  1. Will doing that code attach the existing Firefox browser to automate or what?
  2. How can I fix the error?

1

1 Answers

1
votes

You need to have selenium server running with all appropriate selenium web drivers available.

http://localhost:4444/wd/hub is a service run by the selenium server component. You send commands to selenium server and then it executes them using the appropriate webdriver.

Have a read here: http://www.seleniumhq.org/docs/03_webdriver.jsp#webdriver-and-the-selenium-server