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")
반응형
'python > crawling' 카테고리의 다른 글
selenium 사용중 option headless 추가시 에러날때 (0) | 2021.08.18 |
---|---|
beautiful soup 크롤링 안될때 (0) | 2021.08.11 |