TypeError: __init__() got an unexpected keyword argument 'options' 这是什么情况,我该怎么该
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'
复制代码
|