import time
from selenium import webdriver
1.创建选项对象
chrome_options = webdriver.ChromeOptions()
2.添加参数,进行隐藏
chrome_options.add_experimental_option('excludeSwitches', ['enable-automation'])
3.谷歌浏览器对象
chrome_obj = webdriver.Chrome(options=chrome_options)
chrome_obj.get("https://www.baidu.com/")
time.sleep(3)
chrome_obj.quit()
---------------------------------------------
这是报错信息
Traceback (most recent call last):
File "E:/11期爬虫班/爬虫课程/第七周/19-selenium使用/19.1selenium反检测.py", line 10, in
chrome_obj = webdriver.Chrome(options=chrome_options)
TypeError: init() got an unexpected keyword argument 'options'