How to safely terminate a program using ChromeDriver

I currently have the following problem:

my code is WebDriver driver = new ChromeDriver(); driver.close(); 

But thoissom sometimes leads to an error.

+4
source share
2 answers

Try using driver.quit (); Do not use close (); This is actually a problem, especially if you use Chrome. Try singing Firefox as well.

+3
source

Add driver.quit() to @AfterClass method

Close will close the current active window, and if this is the last window, quit () will be executed, but for this you need to have a valid active session.

If your test fails, the session is probably dead, so when you call it, it does not know where to send the command and does nothing.

Quit will disconnect all clients if there are no active sessions, so if you send out and do not have active sessions, it will simply clear

+3
source

All Articles