パイソンはNoSuchElementException例外処理

セレンとPythonのクローラは、クリックタイムズ異常はNoSuchElementExceptionをシミュレート:見つけることができません......

エラー理由:https://www.cnblogs.com/cttcarrotsgarden/p/11210883.html

通常は、ターゲット要素を見つけることができないときに異常が発生します

パケットはNoSuchElementExceptionのセレン紹介

selenium.common.exceptions インポートはNoSuchElementExceptionが

:試みる
  のxpath = ".//table//tr[1]//td[1]"
  browser.find_element_by_xpath(XPathの).click()
NoSuchElementExceptionを除い:
  印刷(「要素が見つかりません!」)

 

おすすめ

転載: www.cnblogs.com/cttcarrotsgarden/p/11210919.html
おすすめ