Reputation: 68
I am using selenium wire to add proxies to my selenium browser in the following code.
def Proxy():
global options
with open ('proxies.txt', 'r') as f:
lines = f.read().split("\n")
split_proxies = [line.split(":") for line in lines]
proxies = [{'https:': f"https://{p[2]}:{p[3]}@{p[0]}:{p[1]}"} for p in split_proxies]
#proxies = [{'http:':f"http://{p[2]}:{p[3]}@{p[0]}:{p[1]}",'https:':f"https://{p[2]}:{p[3]}@{p[0]}:{p[1]}"} for p in split_proxies]
options = {
'proxy': random.choice(proxies)
}
print(options)
def Login():
PATH = 'C:\\Users\\royce\\Desktop\\instamoni\\chromedriver.exe'
driver = webdriver.Chrome(PATH, seleniumwire_options=options)
driver.get('https://www.instagram.com/')
I have tested and my proxies are working and alive and everything seems fine with them. When selenium opens the page the first page loads but says Not secure connection
even though it is a https site. Then if i try search for something or do anything it just says No internet
. In terminal I also get thrown this errror:
DevTools listening on ws://127.0.0.1:10950/devtools/browser/30122db5-a37d-40d4-8113-f0314768cb6c
[6732:2536:0101/175116.734:ERROR:device_event_log_impl.cc(211)] [17:51:16.734] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not
functioning. (0x1F)
[6732:2536:0101/175116.735:ERROR:device_event_log_impl.cc(211)] [17:51:16.734] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not
functioning. (0x1F)
[6732:2536:0101/175116.736:ERROR:device_event_log_impl.cc(211)] [17:51:16.735] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not
functioning. (0x1F)
Upvotes: 0
Views: 1763
Reputation: 395
You haven't configure ssl proxy attribute. Please, refer to Running Selenium Webdriver with a proxy in Python how to configure proxy properly
prox = Proxy()
prox.proxy_type = ProxyType.MANUAL
prox.http_proxy = "ip_addr:port"
prox.socks_proxy = "ip_addr:port"
prox.ssl_proxy = "ip_addr:port"
Upvotes: 2