WebDriverException: 'geckodriver' executable needs to be in PATH even though it is

六月ゝ 毕业季﹏ 提交于 2019-11-26 21:10:38

This error message...

WebDriverException: 'geckodriver' executable needs to be in PATH. 

...implies that the GeckoDriver wasn't found in the expected default location.

Solution

As you are using MAC based System you need to pass the Key executable_path along with the Value referring to the absolute path of the GeckoDriver as follows :

from selenium import webdriver

browser = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver')

Additional Consideration

Ensure the following :

  • GeckoDriver is present in the specified location.
  • GeckoDriver is having executable permission for non-root users.
  • Execute your @Test as a non-root user.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!