What to do if selenium is recognized

What to do if selenium is recognized

Add the following content, webdriver configuration
from selenium import webdriver
option = webdriver.ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation'])
option.add_argument("--disable-blink-features=AutomationControlled")
# option.add_argument('--headless')
# option.add_argument('--disable-dev-shm-usage')
# option.add_argument('--no-sandbox')
bro = webdriver.Chrome(executable_path='D:/webdriver/chromedriver',options=option)
bro.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
    
    
    "source": """
                Object.defineProperty(navigator, 'webdriver', {
                  get: () => undefined
                })
              """
})
bro.get('你要打开的url')

Guess you like

Origin blog.csdn.net/m0_49501453/article/details/124523052