Update browser.py

it automatically install chromedriver , if version is outdated or the chromedriver not found.
This commit is contained in:
ganesh nikhil 2025-03-18 20:41:51 +05:30 committed by GitHub
parent 9d57d0568c
commit d12b345fe8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, WebDriverException
import chromedriver_autoinstaller
import time
import os
import shutil
@ -36,6 +37,9 @@ class Browser:
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
# Automatically find ChromeDriver path
chromedriver_autoinstaller.install()
# Automatically find ChromeDriver path
chromedriver_path = shutil.which("chromedriver")
if not chromedriver_path: