셀레니움 설치 및 크롬 웹 드라이버 설치
https://chancoding.tistory.com/136
[파이썬] Selenium 셀레니움 설치하기 / 크롬 드라이버 설치하기
목차 1. Python Selenium 설치하기 다른 라이브러리를 설치하는 것과 동일합니다. pip 또는 conda 명령어를 사용해서 설치해주세요. pip install selenium conda install selenium 2. Chrome Driver 설치하기 Selenium을 사
chancoding.tistory.com
1. Selenium 설치
pip3 install selenium
#버전을 정하고 싶을 때
pip3 install selenium == 원하는버전
셀레니움 버전 3과 버전 4의 문법이 다르니 주의하세요!
파이썬 selenium 4(셀레니움4) 최신 버전 find_element 사용법 마스터
파이썬 셀레니움(selenium)은 웹페이지 자동화, 동적 페이지 크롤링, 스크래핑을 할 때 주로 사용합니다. 이 강의에서는 selenium3에서 selenium4로 버전업되며 바뀐 find_element 문법에 대해 설명합니다.
kimflstudio.tistory.com
2. 크롬 버전 확인
오른쪽 상단 점 세 개 버튼 클릭 -> 도움말 -> Chrome 정보
3. 크롬 버전에 맞는 크롬 드라이버 설치
https://chromedriver.chromium.org/downloads
ChromeDriver - WebDriver for Chrome - Downloads
Current Releases If you are using Chrome version 115 or newer, please consult the Chrome for Testing availability dashboard. This page provides convenient JSON endpoints for specific ChromeDriver version downloading. For older versions of Chrome, please se
chromedriver.chromium.org
(ValueError시)
ValueError: Timeout value connect was <object object at 0x7f7515f84420>, but it must be an int, float or None.
미친, selenium의 버전 문제란다. https://github.com/appium/python-client/issues/863
anodos.tistory.com
파이썬에서 Selenium 실행해보기
1. selenium 라이브러리 임포트
from selenium import webdriver
2. 크롬 드라이버 생성
driver = webdriver.Chrome('chromedriver.exe 경로')
크롬 드라이버 생성시 chromedriver.exe의 경로를 넣어줘야 합니다
귀찮다면
윈도우는 C:\Windows
맥은 /usr/local/bin
에 넣어주면 경로 써줄 필요 없습니다

driver = webdriver.Chrome()
3. 사이트 접속
driver.get('사이트 url')
4. 크롬 드라이버 종료
driver.quit()
잘 사용하다가 에러가 난다면 크롬 자동 업데이트로 인한 크롬과 크롬 드라이버의 버전 문제입니다
크롬 드라이버 해당 버전을 재설치하면 됩니다
'Python' 카테고리의 다른 글
Selenium 사용하여 웹 자동화하기3- 뉴스 기사 스크랩 (5) | 2024.01.17 |
---|---|
Selenium 사용하여 웹 자동화하기2 (2) | 2024.01.16 |
웹 스크래핑으로 뉴스 기사 링크 받아오기 (0) | 2024.01.13 |
Python에서 엑셀, csv 다루기 (1) | 2024.01.13 |
웹 스크래핑 (1) | 2024.01.13 |