Python selenium CTRL+C closes chromedriver
问题 How can I catch CTRL+C (a KeyboardInterrupt) without causing the chromedriver to close. It closes the chromedriver when I run my script.py through cmd. driver = webdriver.Chrome() try: while True: #do stuff with chromedriver except KeyboardInterrupt: print "User pressed CTRL + C" #do other stuff with chromedriver It does catch the KeyboardInterrupt in my script, thus my script continues but the chromedriver also gets it and close itself. EDIT 1: The solution here doesn't work when you run the