TransWikia.com

Running Selenium not under a Testing Framework

Software Quality Assurance & Testing Asked by Sebastian Inones on February 12, 2021

I’ve been using Selenium for a while but with a slightly different scope (actually constraints). Instead of running a test for a particular site, I’m interested for instance in filling in a web form from a third party site and get some result, for instance downloading a file, to ensure its quality. So, I’m mainly interested in using Selenium to interact with a browser. So far, so good. I’ve been able to achieve what I wanted.

So, as I’m not interested in "testing" using a Unit Testing Framework like MSTest, I started to use Selenium in a normal C# console application. That worked great!

Afterwards, instead of launching Selenium from a Console I tried to do it from: 1) a WCF Application; and also from 2) an ASP.NET Web Application.
Those 2 approaches worked fine while being launched from within Visual Studio.

However, when I deployed and tried to run those 2 different approaches the Seleniumn InternetExplorerDriver server (the same with chromedriver) was never launched as opposed to what happened when being run from the Console Application.

I’m getting the following error:

OpenQA.Selenium.WebDriverException: A exception with a null response was thrown
sending an HTTP request to the remote WebDriver server for URL
http://localhost:3227/session//window. The status of the exception was ConnectFailure,
and the message was: Unable to connect to the remote server ---> 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:3227
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---

I’m stuck there. I guess it may have to do with who is the Host from where the Selenium Web Server is being run and their privileges. That’s whether it is a Console, a WCF App or an ASP.NET Web App (hosted in IIS) but I don’t know what to do or where to look to sort this out.

One Answer

It can be several things. Are you trying to connect to a remote hub? If that is the case from your error it seems that is trying to connect to http://localhost:3227, to validate go to http://localhost:3227/grid/console to see if it loads the selenium console page. If not, another common issue is incompatibility of versions ob the selenium webdriver in your project and the version of the webdriver client.

Answered by JoMateix on February 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP