-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Getting invalid argument error while passing http proxy #3379
-
hey there i am getting this error while i try to use uc mode with proxy but it works without uc mode
import random import sys from seleniumbase import SB from concurrent.futures import ThreadPoolExecutor sys.argv.append("-n") def select_random_proxy(file_path): with open(file_path, 'r') as file: proxies = file.readlines() selected_proxy = random.choice(proxies).strip() parts = selected_proxy.split(':') user_pass = f"{parts[2]}:{parts[3]}" server_port = f"{parts[0]}:{parts[1]}" return f"{user_pass}@{server_port}" def launch_driver(url): with SB(proxy=select_random_proxy('proxies.txt'), uc=True) as sb: sb.open(url) sb.wait(1) urls = ['https://seleniumbase.io/demo_page' for i in range(3)] with ThreadPoolExecutor(max_workers=len(urls)) as executor: for url in urls: executor.submit(launch_driver, url)
and this is my code
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
Set the multi_proxy
arg to True
to allow multiple proxies with auth at the same time:
Also, post the full stack trace if you're still having issues.
Beta Was this translation helpful? Give feedback.
All reactions
-
oh worked, thanks. Between is there any ways to avoid timeout to avoid this, coz site sometimes takes a bit more time to load the login page after solving captcha or is there any method to send keys after solving
sb.activate_cdp_mode(self.url) sb.uc_gui_click_captcha() sb.sleep(4) sb.send_keys( "input[name='LoginForm[username]']", username, timeout=10 )
2024年12月31日 19:15:39,364 - INFO - Attempt 1 failed:
Element {input[name='LoginForm[username]']} was not found after 7 seconds!
2024年12月31日 19:16:05,629 - INFO - Attempt 2 failed:
Element {input[name='LoginForm[username]']} was not found after 7 seconds!
i added timeout there still i get this error why? also is there any method to activate cdp mode only if the site is available or like refresh page?
Beta Was this translation helpful? Give feedback.