爲了讓程序繼續執行,我們可以用try…except…捕獲異常。捕獲異常後可以打印出異常原因,這樣以便於分析異常原因。
1.NoSuchElementException:沒有找到元素
2.NoSuchFrameException:沒有找到iframe
3.NoSuchWindowException:沒找到窗口句柄handle
4.NoSuchAttributeException:屬性錯誤
5.NoAlertPresentException:沒找到alert彈出框
6.lementNotVisibleException:元素不可見
7.ElementNotSelectableException:元素沒有被選中
8.TimeoutException:查找元素超時
9.BaseException:基類異常,Python所有的錯誤都是從BaseException類派生的