浏览器被识别
chrome版本小于88,还没有启动其他页面时,往页面嵌入js代码去掉webdriver
from selenium.webdriver import Chrome
web = Chrome()
web.execute_cdp_cmd("Page.addScripToEvaluateOnNewDocument", {
"source": """
Windows.navigator.webdriver = undefind
Object.defineProperty(navigator, 'webdriver',{
get: () =>undefined
})
"""
})
chrome版本大于88
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
option = Options()
option.add_argument('--disable-blink-features=AutomationControlled')
web = Chrome(options=option)