반응형
#셀레니움 스크롤 끝까지 내려도 계속 내리는 페이지라면
prev_height = browser.excute_script("return document. body.scrollHeight")
import time
while True:
#첫번째로 스크롤 내리기
browser.excute_script("window.scrollTo(0,document.body.scrollHeight)")
#시간대기
time.sleep(2)
#현재높이 저장
current_height = browser.excute_script("return document. body.scrollHeight")
#현재높이와 끝의 높이가 끝이면 탈출
if current_height == prev_height:
break
#업데이트해줘서 끝낼 수 있도록
prev_height == current_height반응형
'개발 > python' 카테고리의 다른 글
| 파이썬 작업스케줄러 할 때 주의점(셀레니움/schedule모듈) (0) | 2022.04.06 |
|---|---|
| textarea 내용 크롤링 잘 안될 때 (0) | 2022.04.06 |
| 크롤링 영어 나올 때 한글로 바꾸기 (0) | 2022.04.06 |
| 아나콘다 쓸 때 화면 넓게보기 (0) | 2022.04.06 |
| 데이터프레임 행 세로로 들어갈 때(리스트) (0) | 2022.04.06 |