WebDriverException - error fails the test case

WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH.

i have defined the path under .bash_profile.
still, when i type the below command in the terminal - chromedriver PATH is not recognized.
echo $PATH

Kindly advice.

This is a Linux thing. You need to re-activate the .bash_profile. You can do this by closing that terminal, and opening another, or by entering the command:

source .bash_profile

or its alias

. .bash_profile

Still facing the same issue. Attached are the screenshots.

You need to download the chromedriver and put it in one of the directories included in the path variable. You could for example put it in /usr/local/bin

You can test if it actually is in the Python PATH, if you open a cmd and type in chromedriver and hit Enter. If Starting ChromeDriver 2.15.322448 is appearing, the PATH is set appropriately and there is something else going wrong. Then try the following:

Download ChromeDriver

Then you have multiple options:

  • Add it to your system path
  • Put it in the same directory as your python script
  • Specify the location directly via executable_path

driver = webdriver.Chrome(executable_path='C:/path/to/chromedriver.exe')