我在尝试让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有关(我没有,也不知道如何安装)。非常感谢!
https://stackoverflow.com/questions/50767308
复制相似问题