PhantomJS with Selenium error: Message: 'phantomjs' executable needs to be in PATH

you need to download the DRIVER

after that session = webdriver.PhantomJS("c:\driverPath")


Working Solution:

Assumming you are on windows - it is similar for linux

1) download phantomjs here: http://phantomjs.org/download.html pick windows/linux accordingly

2) unzip your phantomjs-2.1.1-windows.zip and save it to for example c drive such as C:\phantomjs-2.1.1-windows\bin (in here there is a phantomjs.exe that is the execute that your system needs)

3) On Windows10 edit your environment path to include this bin folder C:\phantomjs-2.1.1-windows\bin such as this example enter image description here

4) you may or may not restart your machine. Done! it should work! (Webdriver looks for phantomjs.exe and it should be ready now)


I solved same promlem with this command in command line

export PATH=${PATH:+$PATH:}/home/<login>/phantomjs/bin

It's work if /home/login/phantomjs/bin is the path for folder with executable 'phantomjs'.


You need to provide the executable path.This is for linux or more precisely Ubuntu.

You should specify the executable file path(complete), not the directory path that contains the executable.

driver = webdriver.PhantomJS(executable_path='Complete path/to/phantomjs')

It does not require any drivers.

Worked well for me on Ubuntu 16.04.