# Language/Python
[Selenium] NotImplementedError: Only the following pseudo-classes are implemented: nth-of-type.
sokuli
2022. 4. 29. 13:21
- 문제
- 셀레니움으로 selector를 이용하여 크롤링을 진행하던 중 에러 발생
- 원인
- 셀레니움에서 구글 크롬 개발자도구에서 셀렉터 카피에 나오는 child 선택자인 nth-child 를 지원하지 않음
- 해결방법
- tr:nth ->nth-of-type로 바꾸어주면 코드가 잘 작동함
# 기존
soup.select('#tblSort > tbody > tr:nth-child(1) > td:nth-child(5)')
# 변경
soup.select('#tblSort > tbody > tr:nth-of-type(1) > td:nth-of-type(5)')