python selenium TypeError: WebDriver.__init__() got an unexpected keyword argument ‘desired_capabil

option = webdriver.ChromeOptions()
    # option.add_argument('headless') # 无界面
option.add_argument('no-sandbox')
option.add_argument('disable-dev-shm-usage')
option.add_argument("--disable-blink-features=AutomationControlled")
option.add_argument("--disable-extensions")
option.add_argument("--disable-infobars")
option.add_argument("--disable-popup-blocking")
option.add_argument("--disable-default-apps")
option.add_argument("--disable-plugins-discovery")
option.add_experimental_option('excludeSwitches', ['enable-automation'])
option.add_argument('--ignore-certificate-errors')
option.add_argument('--ignore-ssl-errors')
option.add_experimental_option("detach", True)
option.add_argument("--disable-extensions")
option.add_argument("--disable-gpu")
option.add_argument("--disable-features=VizDisplayCompositor")
# 设置 set_capability  desired_capabil 在4版本中取消了 替代的是 set_capability
option.set_capability("goog:loggingPrefs", {'performance': 'ALL'})
caps = DesiredCapabilities.CHROME
# caps['goog:loggingPrefs'] = {'performance': 'ALL'}
driver = webdriver.Chrome(options=option)
# 设置自动下载文件的设置
# driver = webdriver.Chrome(options=option)
driver.get('https://www.baidu.com')

你可能感兴趣的:(python,selenium,数据分析)