Study/Code

Python 크롤링 시 Only the following pseudo-classes are implemented: nth-of-type.오류

MJ_DL 2018. 11. 7. 17:37

Only the following pseudo-classes are implemented: nth-of-type.selenium


구글 크롬 개발자도구에서 셀렉터 카피에서 나오는 child 선택자인 nth-child 를 지원하지 않는다.

tr:nth ->nth-of-type 으로 바꿔준다. 


# F12를 눌러 copy -> copy selector 를 할 경우.


# 기존

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)')