summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortechnicca <cake3327@gmail.com>2024-01-28 20:28:37 +0100
committertechnicca <cake3327@gmail.com>2024-01-28 20:28:37 +0100
commit4c1708d74b30b2b982a55a5a3a3ce1ccac32a10e (patch)
tree8aa75a7837ea249a201738bc6b992704ca6c3e1e
parentMerge pull request #1516 from hlohaus/text (diff)
downloadgpt4free-4c1708d74b30b2b982a55a5a3a3ce1ccac32a10e.tar
gpt4free-4c1708d74b30b2b982a55a5a3a3ce1ccac32a10e.tar.gz
gpt4free-4c1708d74b30b2b982a55a5a3a3ce1ccac32a10e.tar.bz2
gpt4free-4c1708d74b30b2b982a55a5a3a3ce1ccac32a10e.tar.lz
gpt4free-4c1708d74b30b2b982a55a5a3a3ce1ccac32a10e.tar.xz
gpt4free-4c1708d74b30b2b982a55a5a3a3ce1ccac32a10e.tar.zst
gpt4free-4c1708d74b30b2b982a55a5a3a3ce1ccac32a10e.zip
Diffstat (limited to '')
-rw-r--r--g4f/webdriver.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/g4f/webdriver.py b/g4f/webdriver.py
index ee03ff66..44765402 100644
--- a/g4f/webdriver.py
+++ b/g4f/webdriver.py
@@ -15,6 +15,7 @@ except ImportError:
has_requirements = False
import time
+from shutil import which
from os import path
from os import access, R_OK
from .errors import MissingRequirementsError
@@ -55,7 +56,9 @@ def get_browser(
if proxy:
options.add_argument(f'--proxy-server={proxy}')
# Check for system driver in docker
- driver = '/usr/bin/chromedriver'
+ driver = which('chromedriver')
+ if not driver:
+ driver = '/usr/bin/chromedriver'
if not path.isfile(driver) or not access(driver, R_OK):
driver = None
return Chrome(
@@ -218,7 +221,8 @@ class WebDriverSession:
except Exception as e:
if debug.logging:
print(f"Error closing WebDriver: {e}")
- self.default_driver.quit()
+ finally:
+ self.default_driver.quit()
if self.virtual_display:
self.virtual_display.stop()