当前位置:   article > 正文

专门针对浏览器识别undetected_chromedriver了解一下_undetected-chromedriver

undetected-chromedriver

undetected_chromedriver 可以防止浏览器特征被识别,可以 解决被某些网站反爬导致的selenium 无法访问或 滑块验证失败等问题。

两种下载方式

pip install  git+https://github.com/ultrafunkamsterdam/undetected-chromedriver.git
pip install undetected_chromedriver
  • 1
  • 2
import time

import undetected_chromedriver as uc


if __name__ == '__main__':

    browser = uc.Chrome(driver_executable_path=r'C:\Program Files\Google\Chrome\Application\chromedriver.exe')
    browser.get('https://dfjrjgj.hubei.gov.cn/hbjr/index.shtml')
    time.sleep(2)
    print(browser.page_source)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

目前没能隐藏浏览器,跟普通的webdriver 好像不一样chrome_options.add_argument(‘–headless’)无效,有可以隐藏的兄弟麻烦告知一下

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/在线问答5/article/detail/949284
推荐阅读
相关标签
  

闽ICP备14008679号