blackball9  

在使用selenium对某些网站模拟访问的时候会被检测出来,检测出来之后就有可能拿不到我们想要的数据,那么我们怎么可以规避掉呢?

在使用谷歌浏览器的时候我们右键-检查-console-输入window.navigator.webdriver假如返回的是True则是被检测出了了,返回的是undefined则没检测到。

from selenium import webdriver
from selenium.webdriver import ChromeOptions
option = ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation'])

#实例化一个浏览器对象
bro = webdriver.Chrome(executable_path='your driver path',options=option)
bro.get('https://www.taobao.com/')

 

posted on 2019-12-03 21:38  blackpearl9  阅读(1610)  评论(0编辑  收藏  举报