捕捉selenium异常需要先导入异常
from selenium.common.exceptions import TimeoutException
try:
cur_comment_items = WebDriverWait(driver, 10).until(
EC.presence_of_all_elements_located((By.CSS_SELECTOR, "div.weiboitem.active span.heightbox"))
)
except TimeoutException :
break