We have automated tests run by an Azure pipeline on an Azure VM and would like to guarantee that the latest version of Chrome is installed before running the tests. Is there any way to do this?
We use WebDriverManager.Net to automate the Selenium WebDriver binaries management which means we always use the latest versions of those binaries, but that also means that whenever the version changes we get this error on the next test run:
System.InvalidOperationException: session not created: This version of ChromeDriver only supports Chrome version 104. Current browser version is 103.0.5060.134 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe (SessionNotCreated).
The "solution" we've been using is to remote into the VM, open Chrome, and update it. Sometimes a VM restart is necessary as well. While this works, it's quite cumbersome, and ideally it would happen automatically before each test run.
Is there a better way to achieve this?