我正在尝试在Windows 7中使用Selenium 3.0.2和Firefox 50.0.1。我已按照this帖子中的说明正确设置驱动程序和路径但我得到以下内容错误:
Traceback (most recent call last):
File "ixps-bgp.he.net.py", line 38, in <module>
browser = webdriver.Firefox(firefox_binary=binary,capabilities=caps, executable_path='<path to gecko driver>')
File "C:\Users\<myusername>\AppData\Local\Continuum\Anaconda2\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 140, in __init__
self.service.start()
File "C:\Users\<myusername>\AppData\Local\Continuum\Anaconda2\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: '' executable may have wrong permissions.
Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x00000000023BA240>> ignored
即使我尝试以管理员身份执行脚本,我仍然会收到上述错误。我正在使用最新版本的gecko驱动程序(0.13),我尝试了64位和32位版本。这是任何当前版本的已知问题吗?
答案 0 :(得分:1)
您应该使用整个exe地址。如果您只传递文件夹,则会遇到问题。
>>>chromepath = "C:\\Dev\\chromedriver.exe"
>>>driver = webdriver.Chrome(chromepath)