启动硒Webdriver的多个实例时出现我的问题。我尝试了几种方法,例如更改更改请求的方法以及是否无障碍,但是问题仍然存在。我的程序尝试并行化Selenium Webdriver并自动进行Web交互。可以通过处理错误或更改代码以使该错误不再发生的方式来帮助我解决此问题。提前致谢。
if url:
options = Options()
# options.headless = True
options.set_preference('dom.block_multiple_popups', False)
options.set_preference('dom.popup_maximum', 100000000)
driver = webdriver.Firefox(options=options)
driver.set_page_load_timeout(30)
pac = dict()
try:
# driver.get(url)
# driver.execute_script('''window.location.href = '{0}';'''.format(url))
driver.execute_script('''window.location.replace('{0}');'''.format(url))
WebDriverWait(driver, 1000).until(lambda x: self.onload(pac, driver))
pac['code'] = 200
except ReadTimeoutError as ex:
pac['code'] = 404
print("Exception has been thrown. " + str(ex))
return pac
urllib3.exceptions.ReadTimeoutError:HTTPConnectionPool(host ='127.0.0.1',port = 61322):读取超时。 (读取超时=)