|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- from selenium import webdriver
- # 实现无头浏览器
- from selenium.webdriver.chrome.options import Options
- # 实现规避检测
- from selenium.webdriver import ChromeOptions
- # 实现无头浏览器参数
- chrome_options = Options()
- chrome_options.add_argument('--headless')
- chrome_options.add_argument('--disable-gpu')
- # 实现规避检测
- option = ChromeOptions()
- option.add_experimental_option('excludeSwitches',['enable-automation'])
- c1 = webdriver.Chrome(options=chrome_options,options=option)
- c1.get('https://www.baidu.com')
- print(c1.page_source)
复制代码
我是Python3.8
c1 = webdriver.Chrome(chrome_options=chrome_options,options=option) 同时用两个参数就报错
DeprecationWarning: use options instead of chrome_options
让我把chrome_options替换成options 如果我单独用无头浏览器或单独用规避我可以只写一个options=参数
但是如果两个都想用,这样如何能让他不出那个报错提示?
|
|