【问题标题】:selenium.common.exceptions.WebDriverException: Message: Desired Capabilities must be a dictionary PYTHON 3selenium.common.exceptions.WebDriverException:消息:所需的功能必须是字典 PYTHON 3
【发布时间】:2019-11-30 15:03:39
【问题描述】:

你好,我收到了这个错误,

Traceback (most recent call last):
  File "C:\Users\Gebruiker\Desktop\email-account-generator-master\EmailAccountGenerator.py", line 40, in <module>
    driver = webdriver.Remote(service.service_url, capabilities);
  File "C:\Users\Gebruiker\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 139, in __init__
    raise WebDriverException("Desired Capabilities must be a dictionary")
selenium.common.exceptions.WebDriverException: Message: Desired Capabilities must be a dictionary

我的代码问题可能:

service = service.Service(r'C:\Users\Gebruiker\Desktop\email-account-generator-master\chromedriver.exe');
service.start()
capabilities = {'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe',}

driver = webdriver.Remote(service.service_url, capabilities);

【问题讨论】:

  • 您提供了应用程序路径而不是 chromedriver

标签: python selenium google-chrome selenium-webdriver selenium-chromedriver


【解决方案1】:
>>> type({'a'})
<class 'set'>
>>> type({'a':'b'})
<class 'dict'>

{'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe',} 是一个集合而不是一个字典

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-02
    • 2019-08-25
    • 2022-01-21
    • 2020-10-16
    • 2019-03-31
    • 2022-06-17
    相关资源
    最近更新 更多