I'm starting to do small automated tests with Selenium webdriver and Visual Studio. Generated a unit test project with the following code:
Then I downloaded and installed the corresponding webdriver. When running the tests it opens the browser instance and generates this exception:
Result Message:
The UnitTestProject2.UnitTest1.TestChromeDriver test method produced the exception: OpenQA.Selenium.WebDriverException: Unexpected error. System.Net.WebException: It is not possible to connect to the remote server --- > System.Net.Sockets.SocketException: Unable to establish a connection since the destination computer expressly denied such connection 127.0.0.1:46491 in System.Net.Sockets.Socket.DoConnect (EndPoint endPointSnapshot, SocketAddress socketAddress) in System.Net.ServicePoint.ConnectSocketInternal (Boolean connectFailure, Socket s4, Socket s6, Socket & socket, IPAddress & address, ConnectSocketState state, IAsyncResult asyncResult, Exception & exception) --- End of stack tracking of internal exception --- in System.Net.HttpWebRequest.GetRequestStream (TransportContext & context) in System.Net.HttpWebRequest.GetRequestStream () in OpenQA.Selenium.Remote.HttpCommandExecutor.Execute (Command commandToExecute) in OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute (Command commandToExecute) in OpenQA.Selenium.Remote.RemoteWebDriver.Execute (String driverCommandToExecute, Dictionary2 parameters) Seguimiento de la pila de Result:
2 parameters) in OpenQA.Selenium.Remote.RemoteWebDriver.FindElement (String mechanism, String value) in OpenQA.Selenium.Remote.RemoteWebDriver.FindElementById (String id) in OpenQA.Selenium.By. < > c__DisplayClass2.b__0 (ISearchContext context) in OpenQA.Selenium.By.FindElement (ISearchContext context) in OpenQA.Selenium.Remote.RemoteWebDriver.FindElement (By by)
en OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) en OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary
I would like to know how to solve this error. Thanks.