python/crawling
selenium login 403 , access denied
thomass
2021. 8. 11. 16:10
selenium 로그인이 안될때
option = webdriver.ChromeOptions()
option.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36')
그래도 안될때
option.add_argument('--disable-blink-features=AutomationControlled')
option.add_argument("--disable-extensions")
option.add_experimental_option('useAutomationExtension', False)
option.add_experimental_option("excludeSwitches", ["enable-automation"])
아래꺼 넣으니까 된다
전체
option = webdriver.ChromeOptions()
option.add_argument('--no-sandbox')
option.add_argument("disable-gpu")
option.add_argument("--lang=ko_KR")
option.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36')
option.add_argument('--disable-blink-features=AutomationControlled')
option.add_argument("--disable-extensions")
option.add_experimental_option('useAutomationExtension', False)
option.add_experimental_option("excludeSwitches", ["enable-automation"])
driver = webdriver.Chrome(path, options=option)
driver.get("https://naver.com")
반응형