I recently created a self-hosted Azure DevOps Agent and installed with Google Crome as well. Is it possible to install Chrome Driver on this server and can I select a specific version to be used?
I'd like for Chrome Driver 2.42.0.1 to be used by this Self-hosted Agent.
Any help will be much appreciated. Thanks!
One more solution to use Microsoft-hosted agents with already installed Chrome browser chrome driver.
Agents already contain environment variable with ChromeWebDriver location on Agent (It works for "windows-2019" and "vs2017-win2016" Microsoft-hosted agents). Also firefox and IE drivers exists on Agents ( https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md ).
C# code:
ChromeOptions chromeOptions = new ChromeOptions();
var driverPath = Path.Combine(Directory.GetCurrentDirectory());
var envChromeWebDriver = Environment.GetEnvironmentVariable("ChromeWebDriver");
if(!string.IsNullOrEmpty(envChromeWebDriver) &&
File.Exists(Path.Combine(envChromeWebDriver, "chromedriver.exe")))
{
driverPath = envChromeWebDriver;
}
ChromeDriverService defaultService = ChromeDriverService.CreateDefaultService(driverPath);
defaultService.HideCommandPromptWindow = true;
var driver = (IWebDriver) new ChromeDriver(defaultService, chromeOptions);
Installation I found using npm install here: :)
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.
Hope this helps..!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.