It looks like perhaps my build is failing in the pipeline due to incorrect chrome version on the remote host. I tried to add commands to update chrome but hasn’t worked unfortunately. Not sure if it’s something wrong my end… Any help would be appreciated - thanks.
"Test run for /Users/runner/work/mot-cert-support-app-csharp/mot-cert-support-app-csharp/Timesheet.Test/bin/Debug/net8.0/Timesheet.Test.dll (.NETCoreApp,Version=v8.0)
VSTest version 17.11.1 (arm64)
Starting test execution, please wait…
A total of 1 test files matched the specified pattern.
Failed TestLoginReturnsCorrectPage [6 s] Error Message: System.InvalidOperationException : session not created: This version of ChromeDriver only supports Chrome version 131 Current browser version is 130.0.6723.117 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome (SessionNotCreated)
Stack Trace:
at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver…ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Chromium.ChromiumDriver…ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.Chrome.ChromeDriver…ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.Chrome.ChromeDriver…ctor(ChromeOptions options)
at OpenQA.Selenium.Chrome.ChromeDriver…ctor()
at Timesheet.Test.E2E.E2ELoginTest.TestLoginReturnsCorrectPage() in /Users/runner/work/mot-cert-support-app-csharp/mot-cert-support-app-csharp/Timesheet.Test/E2E/E2ELoginTest.cs:line 19
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: 6 s - Timesheet.Test.dll (net8.0)
Error: Process completed with exit code 1."
Pretty much what it says on the tin. Google or whoever is currently the org publishing the chromedrivers at any one time manages to at some point break things, just assume that it will break, write some defensive code around those bits and be prepared to drop tools and find and fix. The only way to avoid the pain is to use a subscription-contract in a cloud-based test platform I suspect.
In order of my guesses I usually
find and delete the /wd cache folder on the machine?
re-install chrome or just reboot?
See if the same issue also occurs on other computers (ones running a different O/S for starters)
build some theory of the cause by finding the actual driver files and verifying they are the latest version or that they are same version as on another working system.
Write a small dummy test app that does not rely on other frameworks… what framework/configuration are you using selenium in BTW? Grid or direct?
Monkey patch and try things and clues you find on the appium and github threads and forums…
I think you also learn to always have at least one other working computer setup.
Through trial and error I managed to get it going. In the YAML configuration, I installed Homebrew > installed Chrome > installed ChromeDriver > verified installations. It’s my intro to pipelines and I’m not web-based so had to trudge along a bit, but pleased it’s working now.
Thanks for the advice, definitely need to consider such scenarios for the future.
The real pain of these things Dan, is that unless you have a record of how it fails most of the time and not always using uninstall and re-install as the only solution, because Chrome updates quite frequently, and at certain points, the webdriver stops functioning and needs to update as well. I have chrome set up so it allows the auto-updates to just run whenever they want to - the downside is that sometimes a test will just entirely bork if the updates run during a test.
I’m using a Python module that saves a timestamp every time that it does an webdriver update check, it’s a bit of a hack, but the update check is expensive to do inside every single test, so the timestamp is used to only do update checks once every 24 hours. But even the driver update check can sometimes break, so long as people are aware, it’s not easy to keep it running smoothly. Mainly it needs someone who can jump on it immediately when it goes wrong.