I have an issue where sometimes driver.quit
is being called on a non-existent browser. I'm working on figuring out why but in the meantime I have written the following (I am looking to do the Javascript version of this: https://stackoverflow.com/a/53909741/4427375):
console.log("I'm here");
try {driver.quit();} catch {
console.log("Catch me");
}
I set a breakpoint on I'm here and the code will reach that point - if I run the driver quit it will fail with NoSuchSessionError: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
What I don't understand is why the catch block never runs.