I\'m trying to run PhantomJS driver in Python but I\'m getting error. I\'ve read that I should pass the whole path as an argument but it di
Make the path in raw string, add 'r':
driver = webdriver.PhantomJS(executable_path=r'D:\Python\phantomjs-2.0.0-windows\bin\phantomjs.exe')
For me none of the above solved the problem; I found the code:
driver = webdriver.PhantomJS()
Will only work for root...
For simplicity's sake place the executable in the same directory as your script:
driver = webdriver.PhantomJS() # now there's no need for a path
For me, this works fine and also don't have to specify path for PhantomJS You need to install pip install phantomjs-binary binary package using pip
pip install phantomjs-binary
it will download a package of approx 60MB. and contains PhantomJS for windows, mac, and Linux as per the running environment. after that, you can use it
from selenium import webdriver
from phantomjs_bin import executable_path
driver = webdriver.PhantomJS(executable_path=executable_path)