Update browser.py

This commit is contained in:
ganesh nikhil
2025-03-19 01:16:25 +05:30
committed by GitHub
parent 088e324b88
commit 2418894dcb
+7 -5
View File
@@ -37,14 +37,16 @@ class Browser:
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
# Automatically install or find ChromeDriver path.(for google chrome and chrome beta).
try:
chromedriver_path = shutil.which("chromedriver") # system installed driver.
#If not found, try auto-installing the correct version
if not chromedriver_path:
chromedriver_path = chromedriver_autoinstaller.install()
except FileNotFoundError as e:
chromedriver_path = shutil.which("chromedriver")
if not chromedriver_path:
raise FileNotFoundError("ChromeDriver not found. Please install it or add it to your PATH.")
service = Service(chromedriver_path)
self.driver = webdriver.Chrome(service=service, options=chrome_options)
self.wait = WebDriverWait(self.driver, 10)