This may be a late post but to help out the forum, which has helped me since almost a decade, here is how we sorted it out.
By default the "Azure Pipelines Hosted VS2017 image" (Or in Classic Editor Agent Specification its called vs2017-win2016) already has Google Chrome (Version 77.0.3865.90 as on 3rd December 2019) and ChromeDriver (77.0.3865.40 as on 3rd December 2019) pre-installed (More info here - https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md)
But we still faced the issue of "selenium-side-runner" not able to find the ChromeDriver due to the missing PATH in the System Variables of Environment variable in Windows.
Image - Chrome Driver Not found
So we tried digging in a bit deeper and found that we could achieve this by uploading the ChromeDriver through the Build process and then copying that into the NodeJs folder within C:Program Files..! Sweet?
Lets walk through the steps briefly to see how this is achieved.
- We first have to visit https://chromedriver.chromium.org/downloads
and search for the version of the driver matching the version on
Chrome installed on the Hosted Agent (Version 77 in our case as on
date)
- Next we create a folder in our Azure Repos and push both the
Chromedriver.exe and our Sample.side file in that folder (Side file
can be named per your preference, and this is generated from the
Selenium IDE)
Adding ChromeDriver.exe and sample.side file in the Repo
- Now we create the Build process to just zip the contents of this
folder and create an Artifact from this to be consumed in the
Release Pipeline.
Build Pipeline explained
- Next we build the Release Pipeline and ensure that the
vs2017-win2016 Agent is taken
- The steps assigned to the Agent include:
- Extracting of the zip file
- Installing the Selenium Side Runner by using NPM and custom
Command - "install -g selenium-side-runner"
- We then have to copy the ChromeDriver.exe from the extracted files
to "C:\Program Files\nodejs" folder using command prompt -
copy "chromedriver.exe" "C:\Program Files\nodejs"
- The final step would be to run the "selenium-side-runner"
command - selenium-side-runner sample.side
- We would see the test result at the end of the task by checking the log file for the task.
Hope this helps..!