Fix #1123 - leaking socket after quit()

This commit is contained in:
benethor 2023-03-12 15:06:33 +01:00
parent bf7dcf8b57
commit 5f750017b7
1 changed files with 3 additions and 0 deletions

View File

@ -709,6 +709,8 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
def quit(self):
try:
self.service.process.kill()
# has to be closed manually, otherwise socket to driver process gets leaked in CLOSE_WAIT
self.command_executor.close()
logger.debug("webdriver process ended")
except (AttributeError, RuntimeError, OSError):
pass
@ -783,6 +785,7 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
def __del__(self):
try:
self.service.process.kill()
self.command_executor.close()
except: # noqa
pass
self.quit()