undetected-chromedriver icon indicating copy to clipboard operation
undetected-chromedriver copied to clipboard

Why manually closing the program browser doesn't close automatically

Open afan441524641 opened this issue 2 years ago • 1 comments

Why manually closing the program browser doesn't close automatically how do i do it

afan441524641 avatar Aug 25 '22 07:08 afan441524641

If you manually interrupt your script how the code to quit the driver and close the browser would be executed ?

sebdelsol avatar Sep 02 '22 15:09 sebdelsol

@afan441524641 To answer you question:

Like @sebdelsol has mentioned in another issue, https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues/789#issuecomment-1222283514

The reason for this is that every time you terminate the script using your IDE, chromedriver does not properly terminate, in many cases resulting in memory leaks. You can view a temp folder in your explorer containing past executable chromedrivers you have used when running your scripts. They are safe to delete:

(C:\Users\username\AppData\Roaming\undetected_chromedriver)

Make sure your script is running the function driver.quit() before terminating.

You can use this snippet to monitor this event:

print("Terminating Process...")

driver.quit() # terminates chromedriver process

print("Process Terminated.")

gigacodr avatar Sep 23 '22 02:09 gigacodr