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

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.

Leave a Comment