【发布时间】:2018-06-08 19:31:26
【问题描述】:
我在尝试让 selenium 处理浏览器时遇到了一些麻烦。 我是这类东西的超级初学者,但我仍然搜索,我发现最相关的回应是我需要以管理员身份运行应用程序,但它没有改变任何东西。这是我的代码和错误消息。非常感谢。
import time
from selenium import webdriver
driver = webdriver.Firefox(executable_path="C:\Program Files\Mozilla Firefox")
我的错误信息:
Traceback (most recent call last):
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Axel\Desktop\PYTHON\code.py", line 3, in <module>
driver = webdriver.Firefox(executable_path="C:\Program Files\Mozilla Firefox")
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 160, in __init__
self.service.start()
File "C:\Users\Axel\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 88, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'Mozilla Firefox' executable may have wrong permissions.
我很确定这两个错误只是一个错误,而且我已经经历了一大堆线程,但我从来没有正确理解事情。我想知道它是否与 geckdriver 有关(我没有也不知道如何安装。) 非常感谢!
【问题讨论】:
标签: python selenium firefox selenium-webdriver geckodriver