Reputation: 410
I am new to Selenium and TFS build. I wrote some UI test cases with Selenium WebDriver, it is running fine in my local environment. Now, I want to run these UI test cases in the TFS build. I did the following to existing build tasks.
The vsTest fails on the below line with error: System.Net.WebException : The underlying connection was closed: The connection was closed unexpectedly.
new DriverManager().SetUpDriver(new ChromeConfig());
I found out that the above line of code tries to check the latest version WebDriver and downloads if not exist from https://chromedriver.storage.googleapis.com. However, on the TFS build server external URL are closed and that could be the reason. Still not sure, I am trying to open this Url on the build server.
[Update] I managed to open googleapis.com Url on the TFS build server. Now a sample test to browse microsoft.com is working but tests for my own website (ex: http://domain or localhost/page.aspx) are still failing. Getting the following error:
OpenQA.Selenium.WebDriverException : unknown error: net::ERR_CONNECTION_REFUSED
(Session info: headless chrome=87.0.4280.66)
Just for information, there is no IIS on the TFS build server. Also, this is an Asp.Net WebForms application.
Do I need to host the website/code on IIS or IIS Express? Just wondering without hosting how will test able to browse it? Sorry for these questions, doing it for the first time and don't have much idea, how to setup everything togather.
Note: I want to do this in build and not in release. Is it feasible to do in the build pipeline? or It must have to be done in the release pipeline? I have configured tests for Chrome in headless mode
Upvotes: 0
Views: 583
Reputation: 35109
As far as I known, Selenium UI test can be executed in both build and release pipeline.
OpenQA.Selenium.WebDriverException : unknown error: cannot find Chrome binary
The issue seems to be that the chrome driver cannot find the chrome.exe file.
Since you are using the TFS to run the test , you need to make sure that Chrome is installed on the machine where the agent is located. If only the chrome driver is installed, you will face this issue.
If you have install the Chrome, you could check the file path of chrome.exe.
As per the ChromeDriver - Requirements.
On the other hand, this issue may be related to the version of chrome, this is an open ticket with similar issues, you could refer to it.
You could try to run the following script and check if it could work:
npm i chromedriver --chromedriver_version=LATEST --save-dev
Upvotes: 2