首页 > 解决方案 > Python Selenium geckodriver 路径

问题描述

我的脚本看起来是这样的:

from selenium import webdriver
driver = webdriver.Firefox(executable_path='/bin/geckodriver.exe')
driver.get('http://inventwithpython.com')

有这样的错误:

Traceback (most recent call last):
  File "/home/natalia/.local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "slm.py", line 4, in <module>
    driver = webdriver.Firefox(executable_path='/bin/geckodriver.exe')
  File "/home/natalia/.local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
    self.service.start()
  File "/home/natalia/.local/lib/python3.5/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: 'geckodriver.exe' executable may have wrong permissions. 

我把 geckodriver 放到文件夹 bin.. 现在我不知道该怎么办。请给ma一个建议。

标签: pythonlinuxseleniumpathgeckodriver

解决方案


推荐阅读