본문 바로가기
IT/PYTHON

python selenium 을 이용한 크롤링 예제.

by 골든크랩 2025. 4. 15.
728x90
반응형
'''
# Chrome 버전
# 버전 135.0.7049.85(공식 빌드) (64비트)
# chrome 115이상을 사용하면...Chrome for Testing 가용성 대시보드를 참조해야함.
# 이 대시보드에는 특정 ChromeDriver 버전을 다운로드할 수 있는  JSON 엔드포인트가 있다.


# 버전 135.0.7049.85(공식 빌드) (64비트) 용 다운로드

# selenium 4.31.0 사용

Selenium 4.6부터는 Selenium Manager라는 기능이 내장되어 있어,
별도로 드라이버 경로를 지정하지 않아도 브라우저 버전에 맞는 드라이버를 자동으로 다운로드하고 사용할 수 있습니다.
'''

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--start-maximized")

# 직접 다운로드한 chrome driver의 경로를 지정합니다.
# service = Service(executable_path="F:Projects/Python/Python-Crawling/chromedriver-win64/chromedriver.exe")
service = Service(executable_path="F:\Projects\Python\Python-Crawling\chromedriver-win64\chromedriver.exe")

driver = webdriver.Chrome(service=service, options=chrome_options)
print(driver.title)

driver.quit()
728x90
반응형

'IT > PYTHON' 카테고리의 다른 글

고급 Python 기능들  (0) 2025.04.24
Python PyQt5 QAxContainer import 에러  (0) 2024.03.14
conda install과 pip install 차이점  (0) 2024.03.13
jupyter notebook 단축키  (0) 2023.12.21
jupyter notebook 도커 설치하기  (0) 2023.12.21

댓글