赞
踩
undetected_chromedriver 可以防止浏览器特征被识别,可以 解决被某些网站反爬导致的selenium 无法访问或 滑块验证失败等问题。
两种下载方式
pip install git+https://github.com/ultrafunkamsterdam/undetected-chromedriver.git
pip install undetected_chromedriver
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)
目前没能隐藏浏览器,跟普通的webdriver 好像不一样chrome_options.add_argument(‘–headless’)无效,有可以隐藏的兄弟麻烦告知一下
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。