在使用selenium對某些網站模擬訪問的時候會被檢測出來,檢測出來之后就有可能拿不到我們想要的數據,那么我們怎么可以規避掉呢?
在使用谷歌瀏覽器的時候我們右鍵-檢查-console-輸入window.navigator.webdriver假如返回的是True則是被檢測出了了,返回的是undefined則沒檢測到。
from selenium import webdriver from selenium.webdriver import ChromeOptions option = ChromeOptions() option.add_experimental_option('excludeSwitches', ['enable-automation']) #實例化一個瀏覽器對象 bro = webdriver.Chrome(executable_path='your driver path',options=option) bro.get('https://www.taobao.com/')
