It seems like the browser opened by selenium will automatically closed when the calling application end, regeraless if driver.quit()
is called or not.
If an exception happend, the browser shall remain opened.
NOTE: Tested on Selenium 3.141
with chrome driver. This behaviour might not be consistent.
I am building a CLI app, so I use an accept input command to stop the application from ending (prevent browser close).
input('Hit Enter to quit: ')driver.quit()