So, I have a selenium code in python that stops and wait me finishing the captcha.
(因此,我在python中有一个硒代码,该代码停止并等待我完成验证码。)
The 80 seconds of timeout were insufficient to me, so i found this code online: (80秒的超时对我来说还不够,所以我在网上找到了以下代码:)
def get_session_data(driver):
url = driver.command_executor._url
session_id = driver.session_id
return url, session_id
driver = webdriver.Chrome(executable_path = '/chromedriver78')
driver.delete_all_cookies()
wait = WebDriverWait(driver, 30)
session_url, session_id = get_session_data(driver)
while True:
try:
wait.until(condition)
except TimeoutException:
driver = webdriver.Remote(command_executor = session_url, desired_capabilities = {})
driver.session_id = session_id
else:
break
But every time Python does a cycle in the while-true, pops up a chrome page with no link.
(但是每次Python在while-true中执行一个循环时,都会弹出一个没有链接的镶边页面。)
How to avoid this behavior? (如何避免这种行为?)
ask by Gianla translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…