mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2026-04-16 21:25:35 +02:00
@@ -245,6 +245,7 @@ def _resolve_challenge(req: V1RequestBase, method: str) -> ChallengeResolutionT:
|
||||
raise Exception('Error solving the challenge. ' + str(e).replace('\n', '\\n'))
|
||||
finally:
|
||||
if not req.session and driver is not None:
|
||||
driver.close()
|
||||
driver.quit()
|
||||
logging.debug('A used instance of webdriver has been destroyed')
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ class SessionsStorage:
|
||||
return False
|
||||
|
||||
session = self.sessions.pop(session_id)
|
||||
session.driver.close()
|
||||
session.driver.quit()
|
||||
return True
|
||||
|
||||
|
||||
@@ -788,15 +788,6 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
|
||||
logger.debug("gracefully closed browser")
|
||||
except Exception as e: # noqa
|
||||
pass
|
||||
# Force kill Chrome process in Windows
|
||||
# https://github.com/FlareSolverr/FlareSolverr/issues/772
|
||||
if os.name == 'nt':
|
||||
try:
|
||||
subprocess.call(['taskkill', '/f', '/pid', str(self.browser_pid)],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL)
|
||||
except Exception:
|
||||
pass
|
||||
if (
|
||||
hasattr(self, "keep_user_data_dir")
|
||||
and hasattr(self, "user_data_dir")
|
||||
|
||||
@@ -187,4 +187,5 @@ def test():
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
driver.close()
|
||||
driver.quit()
|
||||
|
||||
@@ -314,6 +314,7 @@ def get_user_agent(driver=None) -> str:
|
||||
raise Exception("Error getting browser User-Agent. " + str(e))
|
||||
finally:
|
||||
if driver is not None:
|
||||
driver.close()
|
||||
driver.quit()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user