개발

[Selenium] NoSuchElementException

도깨비! 2022. 4. 15. 00:31
반응형

selenium에서 element를 가져올때, 종종 잘못된 경로로 인해 가져오지 못할때가 있습니다.

이때, NoSuchElementException을 사용해주면 좋습니다.

 

from selenium.common.exceptions import NoSuchElementException


````

try:

	``````
except NoSuchElementException:
	``````

 

위 코드로 try 하위에서 발생한 element undefined 에러는 대응이 가능합니다.