반응형
셀레늄 우회, 로컬에서 크롬 실행
크롬 옵션을 사용하여 셀레늄 자동화 탐지 우회하기
아래 코드 중, 아무거나 되는거 사용하면 될 듯
1. 크롬 자동화 탐지 방지 옵션
# 모듈 불러오기
from selenium.webdriver.chrome.options import Options
option = Options()
option.add_experimental_option("detach", True)
# 자동화 탐지 방지
option.add_argument("disable-blink-features=AutomationControlled")
# 자동화 표시 제거
option.add_experimental_option("excludeSwitches", ["enable-automation"])
# 자동화 확장 기능 사용 안 함
option.add_experimental_option('useAutomationExtension', False)
2. 로컬에서 크롬 실행하기
# 모듈 불러오기
from selenium.webdriver.chrome.options import Options
import subprocess
# 실행파일 경로로 크롬 실행
subprocess.Popen('C:/Program Files/Google/Chrome/Application/chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\chromeCookie"')
# drive 옵션 추가
option = Options()
option.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
driver = webdriver.Chrome(options=option)
# 웹사이트 접속
driver.get('웹사이트 주소')
옵션 사용 전
옵션 사용 후
반응형
'개발기록 > python' 카테고리의 다른 글
[python] kakao 카카오 메시지 감지 자동 발송 매크로 (pyautogui) (0) | 2025.06.04 |
---|---|
[python] 자료구조 (0) | 2025.04.07 |
[python] datetime 현재시간 구하기 시간비교 (0) | 2025.02.20 |
[python] 주파수 신호 분석 방법론 3 - Wavelet 변환 (0) | 2024.11.26 |
[python] 주파수 신호 분석 방법론 2 - STFT (Short Time Fourier Transform) (1) | 2024.11.25 |
댓글