美文网首页
selenium 隐藏 window.navigator.web

selenium 隐藏 window.navigator.web

作者: 魔童转世 | 来源:发表于2020-10-24 10:47 被阅读0次
    from selenium import webdriver
    options = webdriver.ChromeOptions()
    options.add_experimental_option("excludeSwitches", ["enable-automation"])
    options.add_experimental_option('useAutomationExtension', False)
    driver = webdriver.Chrome(options=options, executable_path='./chromedriver')
    driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
      "source": """
        Object.defineProperty(navigator, 'webdriver', {
          get: () => undefined
        })
      """
    })
    driver.get('http://xxxxxx')
    

    相关文章

      网友评论

          本文标题:selenium 隐藏 window.navigator.web

          本文链接:https://www.haomeiwen.com/subject/phyimktx.html