selenium.common.exceptions.WebDriverException:消息:所需功能必须是字典PYTHON 3

时间:2019-11-30 15:03:39

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

您好,我收到此错误,

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);

1 个答案:

答案 0 :(得分:1)

>>> type({'a'})
<class 'set'>
>>> type({'a':'b'})
<class 'dict'>

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