终于知道怎么去捕捉异常了,
try:
dr.find_element_by_xpath("//html/body/div[1]/div/div[1]/a[4]").click
except :
driver.get_screenshot_as_file("D:/screenshots/test01.png") #如果try里面的语句出错的话,就会执行Except中的东西;