B
B
Bjornie2017-11-07 20:38:53
Python
Bjornie, 2017-11-07 20:38:53

How to exit the program when the driver exits (Selenium)?

Question about Selenium library and Chrome driver.
In the event of an unplanned program crash for some reason (the element was not found, the form was filled out incorrectly, something went wrong), chromedriver.exe remains running in the processes , which remains hanging there.
In case of successful completion of the program or expected events, I produce driver.quit ().
However, what if the program crashed in an unexpected place? How to track this and turn off the driver 100% (close the window)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Astrohas, 2017-11-07
@Astrohas

try:
    делаем по своему
except Exception:
   driver.quit()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question