It can actually be a little error prone to stop a sauce session because we can get back a null driver for multiple reasons. Let's wrap this command into a nice method for our clients so that it's not error prone and easier to use.
if(_driver != null)
((IJavaScriptExecutor)_driver).ExecuteScript("sauce:job-result=" + (passed ? "passed" : "failed"));
_driver?.Quit();
It can actually be a little error prone to stop a sauce session because we can get back a null driver for multiple reasons. Let's wrap this command into a nice method for our clients so that it's not error prone and easier to use.