selenium 으로 자동화 작업을 하는데, 사이트에서 blocking 되는 경우가 있습니다.
저같은 경우 다음과 같이 설정을 해주니 정상적으로 작동했습니다:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options)
driver.execute_cdp_cmd('Network.setUserAgentOverride', {"userAgent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.53 Safari/537.36'})
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
driver.get("SITE_URL")
관련 내용은 다음 페이지를 참고하시기 바랍니다:
Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection
I'm trying to automate a very basic task in a website using selenium and chrome but somehow the website detects when chrome is driven by selenium and blocks every request. I suspect that the websit...
stackoverflow.com
selenium.common.exceptions.JavascriptException:
'생활정보' 카테고리의 다른 글
부모님 건강하실 때 준비하는 장례 절차 (0) | 2020.07.12 |
---|---|
SKT 임대폰 서비스 이용 정보와 팁 (0) | 2020.06.04 |