使用 seleniumwire 和代理时,有什么方法可以修复 "No internet connection please check proxy server" 吗?
Is there any way to fix "No internet connection please check proxy server" when using seleniumwire and proxies?
我在以下代码中使用 selenium wire 将代理添加到我的 selenium 浏览器。
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/')
我已经测试过,我的代理可以正常工作并且一切正常。当 selenium 打开页面时,第一页加载但显示 Not secure connection
即使它是 https 站点。然后,如果我尝试搜索某些内容或执行任何操作,它只会显示 No internet
。在终端我也被抛出这个错误:
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)
您还没有配置ssl代理属性。请参考Running Selenium Webdriver with a proxy in Python如何正确配置代理
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"
我在以下代码中使用 selenium wire 将代理添加到我的 selenium 浏览器。
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/')
我已经测试过,我的代理可以正常工作并且一切正常。当 selenium 打开页面时,第一页加载但显示 Not secure connection
即使它是 https 站点。然后,如果我尝试搜索某些内容或执行任何操作,它只会显示 No internet
。在终端我也被抛出这个错误:
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)
您还没有配置ssl代理属性。请参考Running Selenium Webdriver with a proxy in Python如何正确配置代理
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"