I call driver.quit()
on test teardown, but the chromedriver process stays alive and doesn't shut down.
So between executions sometimes Chrome doesn't open at all, and I need to manually shut down the processes.
Someone familiar with this issue?
I'm using selenium 3.5
close() closes only the current window on which Selenium is running automated tests. The WebDriver session, however, remains active. On the other hand, the driver. quit() method closes all browser windows and ends the WebDriver session.
close() The close() method is a Webdriver command that closes the browser window currently in focus. It is best to use the close() command when multiple browser tabs or windows are open. If only one window is open in the entire browser, then the close() command will quit the entire browser session.
close() method is used to close the current browser window on which the focus is set, on the other hand quit() method essentially calls the driver.
The difference between quit() and close() driver. quit() : The quit() method quits the driver, closing every associated window. driver. close() : The close() method closes the currently focused window, quitting the driver if the current window is the only open window.
Change your code to below, to be double sure the process is not there after quit
import signal
import os
pid = driver.service.process.pid
driver.quit()
try:
os.kill(int(pid), signal.SIGTERM)
print("Killed chrome using process")
except ProcessLookupError as ex:
pass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With