note: PhantomJS runs in PyCharm environment, but not IDLE
I have successfully used PhantomJS in Python in the past, but I do not know what to do to revert to that set up.
I am receiving this error in Python (2.7.11): selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
I have tried to 'symlink' phantomjs to the path (usr/local/bin [which is also in the path]), and even manually locate /usr/local/bin to place phantomjs in the bin folder. However, there is still a path error in python.
What am I missing?
I solved this by passing the executable_path
keyword arg to the driver constructor. For example:
driver = webdriver.PhantomJS(executable_path="/Path/to/driver/phantomjs")
Note that this must be the driver file itself, not the folder which contains it.
Thanks to PhantomJS() not running in pyCharm for hinting at this solution.
Download - http://phantomjs.org/download.html
/usr/bin is restricted on Mac, but putting /bin/phantomjs in /usr/local/bin works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With