공부한 것
- 크롬 드라이버 자동 설치하는 라이브러리
- selenium에서 quit()함수 : 마지막에 크롬드라이버 모두 닫아주는 함수 ⇒ 사용해줘야하는 이유는 컴퓨터 메모리 누수 방지
selenium을 이용하여 exe 파일을 만들고 난뒤 배포하고 나서, 다른 컴퓨터에서 사용할 시에 따로 크롬드라이버를 설치해줘야하는 번거러움이 있었다.
그 번거로움을 대체하여서 찾다 보니 자동설치 라이브러리를 찾게 되었다.
chromedriver_autoinstaller 라는 라이브러리
참고 사이트 [https://pypi.org/project/chromedriver-autoinstaller/]
설치 방법
- pip install chromedriver-autoinstaller
사용법
from selenium import webdriver
import chromedriver_autoinstaller
path = chromedriver_autoinstaller.install()
# Check if the current version of chromedriver exists
# and if it doesn't exist, download it automatically,
# then add chromedriver to path
driver = webdriver.Chrome(path)
driver.get("https://leonslife.tistory.com")
driver.close()
driver.quit()
'오늘 배운 내용' 카테고리의 다른 글
파이썬 Python [활용] : 사진을 스케치하는 프로그램을 만들어 보자 (0) | 2020.09.25 |
---|---|
파이썬 Python[활용] : 동영상에서 물체 추적해서 동영상 만들기 (0) | 2020.09.17 |
파이썬 Python [활용] : Scapy를 통해서 특정 망 내에서 디바이스 정보 가지고 오기 (0) | 2020.09.16 |
Python 파이썬[활용] : 동영상을 한프레임 씩 읽어와서 변환하기 (0) | 2020.09.08 |
파이썬 : Python 웹스크랩핑 or 크롤링 정리 (0) | 2020.08.23 |