Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to close Python selenium webdriver window

I have a python script that scraps data off from a website on an hourly basis. It is stored on the server at the moment and is working well as I am using task scheduler to schedule it to execute the script on an hourly basis.

I am using this code

driver.quit() 

to quit the browser window

My problem to this that whenever I am not logging in to the server, it will start stacking up the webdriver window as somehow the driver.quit() function does not work when I am logging into the server. every morning when I came to work, I have tons of window to close from the server.

I tried to quit, close, dispose, but it doesn't help. What else I can try?

like image 470
Kok chuan Lim Avatar asked Mar 04 '17 01:03

Kok chuan Lim


People also ask

How do I close Chrome in Selenium Python?

New Selenium IDE Using the close() method. Using the quit() method.

How do I close a chrome window in Python?

quit() - closes all browser windows and ends driver's session/process.

How do I close a tab in Selenium WebDriver?

How to Close Tab in Selenium. In the code below, first get all the window handles, then switch to the tab to be closed. After this, close the driver using driver. close().


1 Answers

In python using chromedriver, I quit Chrome processes with:

driver.close() 
like image 59
jeanhuguesroy Avatar answered Oct 12 '22 20:10

jeanhuguesroy