File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 22import undetected_chromedriver as uc
33from selenium .webdriver .common .by import By
44from selenium .webdriver .chrome .options import Options
5+ from selenium .webdriver .chrome .service import Service
56import sys
67import argparse
78import tty , termios
8- import json # Add this import at the top
9- import os # new import
9+ import json
10+ import os
11+
12+ WEBDRIVER_PATH = os .environ .get ("CHROME_DRIVER" )
1013
1114def getch ():
1215 fd = sys .stdin .fileno ()
@@ -73,6 +76,7 @@ def str2bool(value):
7376GEO_LONGITUDE = 11.576124
7477GEO_ACCURACY_M = 50
7578
79+
7680cdp_commands = {
7781 "Emulation.setTimezoneOverride" : {"timezoneId" : TIMEZONE_ID },
7882 "Emulation.setLocaleOverride" : {"locale" : LANGUAGE },
@@ -94,7 +98,11 @@ def str2bool(value):
9498 os .makedirs (PROFILE_DIR , exist_ok = True )
9599 chrome_options .add_argument (f"--user-data-dir={ PROFILE_DIR } " )
96100
97- driver = uc .Chrome (options = chrome_options )
101+ if WEBDRIVER_PATH :
102+ service = Service (WEBDRIVER_PATH )
103+ driver = uc .Chrome (service = service , options = chrome_options )
104+ else :
105+ driver = uc .Chrome (options = chrome_options )
98106
99107for each_command in cdp_commands :
100108 driver .execute_cdp_cmd (each_command , cdp_commands [each_command ])
You can’t perform that action at this time.
0 commit comments