I am attempting to run this script:
https://github.com/Chillee/coursera-dl-all
However, the script fails at the line session = webdriver.PhantomJS()
you need to download the DRIVER
after that session = webdriver.PhantomJS("c:\driverPath")
Why Don't you use the easiest way ever and past the phantomjs.exe
into the Python scripts directory which is already added to the system environment the python directory path should be something like this
C:\Users\[user]\AppData\Local\Programs\Python\Python[version]\Scripts
# you can use it as following
from selenium import webdriver
driver = webdriver.PhantomJS()
This will work perfectly.
import platform
from os import getcwd
from selenium import webdriver
if (platform.system() == 'Windows'):
driver = webdriver.PhantomJS(executable_path=getcwd() + "\phantomjs")
if (platform.system() == 'Darwin'):
driver = webdriver.PhantomJS(executable_path=getcwd() + "/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.
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
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'.