728x90
반응형
[Selenium] 셀레니움으로 크롤링 할 때 시크릿 모드 브라우저 열기
크롬 브라우저 옵션에 --incognito 플래그를 추가하면 간단하게 시크릿 모드로 실행 시킬 수 있습니다 !!
예제코드
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
# 크롬 옵션 설정
chrome_options = Options()
chrome_options.add_argument("--incognito") # 시크릿 모드 옵션 추가
# 크롬 드라이버 경로 설정 (자신의 경로로 수정)
driver_path = "/path/to/chromedriver" # 크롬 드라이버 경로를 설정하세요.
# 드라이버 생성 (옵션 포함)
driver = webdriver.Chrome(executable_path=driver_path, options=chrome_options)
# 원하는 URL로 이동
driver.get("https://www.example.com")
# 작업이 끝나면 브라우저 닫기
driver.quit()
728x90
반응형
'Coding > Python' 카테고리의 다른 글
의존성 주입(Dependency Injection)과 FastAPI에서의 활용 (2) | 2024.11.01 |
---|---|
Python을 이용한 POST 요청 보내기 - 웹사이트에 로그인하는 방법 (0) | 2024.09.30 |
[Python & FastAPI] FastAPI와 Gunicorn을 사용한 서버 설정 (systemctl 에 설정하기) (0) | 2024.08.23 |
[Python] Django, Flask, FastAPI 대표 프레임워크의 장점과 단점 (0) | 2024.07.30 |
[Python & Matplotlib] Matplotlib 한글이 깨지는 문제 해결하는 방법 !! (0) | 2024.06.27 |
댓글