wait = WebDriverWait(driver, 5)
count = 1
while(count==1):
count=0
try:
wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="content"]/div/div/div[1]/div[3]/div[1]/section[2]/section/div[15]/div/div[2]/button'))).click()
except Exception as e:
print(e)
count=1
try:
driver.refresh()
except Exception as e:
print(e)
Just wrapp it with while and try/except
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…