[py] 셀레니움 기본 설정

PHOTO EMBED

Wed Jan 11 2023 18:33:24 GMT+0000 (Coordinated Universal Time)

Saved by @ncia

#셀레니움 기본설정
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager #크롬 드라이버 자동 업데이트

chrome_options = Options() #브라우저 꺼짐 방지
chrome_options.add_experimental_option("detach", True)
chrome_options.add_experimental_option("excludeSwitches", ["enable-logging"]) #불필요한 에러 메세지 삭제

service = Service(executable_path = ChromeDriverManager().install()) #크롬 드라이버 최신 버전 자동 설치 후 서비스 만들기
driver = webdriver.Chrome(service = service, options = chrome_options)
driver.get("http://www.naver.com") #웹페이지 해당 주소 이동
content_copyCOPY

https://goddino.tistory.com/353