我已经阅读了关于如何设置chrome webdriver的api文档,但我对** kwargs有点新,我必须将executable_path作为字典条目传递,有人可以告诉我我做错了什么我的代码?
executable_path = {'executable_path':'/usr/bing/firefox-esr'}
browser = Browser('firefox', **executable_path)
这是我得到的错误
Traceback (most recent call last):
File "logger.py", line 10, in <module>
browser = Browser('firefox', **executable_path)
File "/usr/local/lib/python2.7/dist-packages/splinter/browser.py", line 63, in Browser
return driver(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'executable_path'
这是分裂网站提供的代码
executable_path = {'executable_path':'</path/to/chrome>'}
browser = Browser('chrome', **executable_path)
答案 0 :(得分:0)
您指定了'firefox'而不是'chrome',而Splinter的firefox驱动程序没有executable_path
参数。
请参阅Splinter 0.7.4的来源:https://github.com/cobrateam/splinter/blob/e23df9c7e0ba9d1b495292cf8c23c0fe4192b26d/splinter/driver/webdriver/firefox.py#L20
答案 1 :(得分:0)
Nvm伙计们,问题是我在usr / local / bin文件夹中没有geckodriver然后你可以设置browser = Browser('firefox')