I have recently installed PhantomJS and encountered this error on my first run:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
d
These are the precise steps that worked for me:
Purge old phantomjs
apt purge phantomjs
Wget the latest phantomjs (as per http://phantomjs.org/download.html)
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
Untar it
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
Moved the phantomjs executable to /usr/bin/ (may need sudo)
cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/
For me it start to work after
apt install nodejs-legacy # just an alias node/nodejs to make npm install work
apt purge phantomjs # optionaly
npm install -g phantomjs # most important part because apt installation failed for me
The reason is that I used apt-get install Phantomjs
to install it, but it seems that it is a not full-functional Phantomjs version installed by apt-get
. So, download manually from the Phantomjs website and add the containing direction to the PATH
environment variable.