我用selenium用python做了一个机器人,但是我有一个错误,我不能通过。
我的脚本运行了X次,每次使用新的代理时,问题是代理有时不工作,脚本崩溃
我有消息“无法到达此站点”或"err_connection_failed",我已经尝试与webdriverwait,做一个循环尝试,如果它可以通过但仍然阻止,当driver.get.url不能连接到网站,脚本崩溃。
谢谢你的帮忙
引发exception_class(message,screen,stacktrace)会话消息:未知错误: net::ERR_TUNNEL_CONNECTION_FAILED (会话信息: chrome=87.0.4280.88)
发布于 2020-12-18 00:41:29
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType
temp = True
while temp:
try:
# Add your proxxy change code here
driver = webdriver.Chrome(options=options)
driver.get("https://www.google.com")
temp = False
except Exception as e:
print(e)
driver.quit()您可以添加类似这样的内容来捕获异常,然后重试,直到它通过为止
发布于 2020-12-21 05:33:13
https://stackoverflow.com/questions/65341279
复制相似问题