feat: stealth option in config

This commit is contained in:
martin legrand
2025-03-30 16:00:38 +02:00
parent a0b09410b3
commit 039ea71678
2 changed files with 11 additions and 5 deletions
+6 -4
View File
@@ -65,10 +65,12 @@ def create_driver(headless=False, stealth_mode=True) -> webdriver.Chrome:
chrome_options.add_argument("--mute-audio")
chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument('--window-size=1080,560')
try:
chrome_options.add_extension("./crx/nopecha.crx")
except Exception as e:
print(f"Failed to load AntiCaptcha extension: {str(e)}")
if not stealth_mode:
# crx file can't be installed in stealth mode
crx_path = "./crx/nopecha.crx"
if not os.path.exists(crx_path):
raise FileNotFoundError(f"Extension file not found at: {crx_path}")
chrome_options.add_extension(crx_path)
chromedriver_path = shutil.which("chromedriver")
if not chromedriver_path: