728x90
반응형

[Python] 셀레니움(Selenium) 페이지 스크롤 기능 만들기 !
코드로 바로 보시죠 !
# 스크롤 높이
last_height = driver.execute_script("return document.body.scrollHeight")
while True:
# 끝까지 스크롤
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
# 대기 1초 (로딩으로 인해 알맞는 초 조절)
time.sleep(1)
# 스크롤 길이 비교로 끝까지 갔는지 확인
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
break
last_height = new_height

728x90
반응형
'Coding > Python' 카테고리의 다른 글
[Python] 파이썬 TypeError: string indices must be integers 에러 원인 및 해결 방법 !! (0) | 2022.07.27 |
---|---|
[Python] 셀레니움(Selenium) Element 텍스트 읽기 & 가져오기 ! (2) | 2022.07.07 |
이미지 & 사진 크롤링(Crawling) 프로그램 - 원하는 사진 한번에 다운 받기! (0) | 2022.06.22 |
[Python & tkinter] 파이썬 GUI 입력 및 콤보박스(Combobox) 만드는 방법 - #2 (frame 추가) (0) | 2022.06.17 |
[Python & tkinter] 파이썬 GUI 입력 및 콤보박스(Combobox) 만드는 방법 - #1 (0) | 2022.06.15 |
댓글