chromedriver: use binary location

master
emamaker 2022-02-05 09:45:35 +01:00
parent 913b5d0ee3
commit c8842759b7
1 changed files with 6 additions and 2 deletions

View File

@ -47,6 +47,10 @@ def create_tor_proxy(socks_port, control_port):
return tor_process return tor_process
def start_browser(use_tor=False, headless=False): def start_browser(use_tor=False, headless=False):
os.mkdir(get_chrome_data_dir())
shutil.copy('/usr/bin/chromedriver', './'+get_chrome_data_dir())
options = uc.ChromeOptions() options = uc.ChromeOptions()
if headless: if headless:
@ -70,8 +74,8 @@ def start_browser(use_tor=False, headless=False):
options.add_argument(f'--proxy-server=socks5://localhost:{SOCKS_PORT}') options.add_argument(f'--proxy-server=socks5://localhost:{SOCKS_PORT}')
else: else:
proxies = [] proxies = []
driver=uc.Chrome(options=options) driver = uc.Chrome(options=options, chromedriver_executable_path=get_chrome_data_dir()+'/chromedriver')
ip = requests.get("http://httpbin.org/ip", proxies=proxies).json()["origin"] ip = requests.get("http://httpbin.org/ip", proxies=proxies).json()["origin"]
print (f'IP is {ip}') print (f'IP is {ip}')