0

I've tried implementing the following, passing along the path of phantomJS.exe installed in the system.

from splinter import Browser
from selenium import webdriver

driver = webdriver.PhantomJS(executable_path="C:\Users\Lenovo\AppData\Local\Enthought\Canopy\User\Lib\site-packages\phantomJS\phantomJS.exe")
browser = Browser(driver)
browser.visit('www.google.com')
if browser.is_element_present_by_name('search'):
    print True

Unfortunately it throws me this error: DriverNotFoundError: No driver for <selenium.webdriver.phantomjs.webdriver.WebDriver object at 0x000000000970A8D0>

Whereas, as documented in splinter, I should be able to just use phantomJS by using browser = Browser('phantomJS'). This gives me DriverNotFoundError: No driver for phantomJS'

Can anyone point me out where I went wrong?

Kai
  • 45
  • 1
  • 8
  • https://splinter.readthedocs.org/en/latest/drivers/phantomjs.html – heinst Apr 27 '15 at 14:58
  • Have you installed phantomjs to your machione first and added phantomjs binary to PATH (something like C:\PhantomJs\bin\phantomjs where the executable is)? Looks like you are using windows, so http://phantomjs.org/download.html . So if you will do everything correctly you should type "phantomjs --version" in your cmd and see the output – Stan E Apr 27 '15 at 19:50
  • Thanks @Stanjer, I set it to path already. Apparently, I should have been using 'phantomjs' instead of 'phantomJS'. Thanks for the help! – Kai May 01 '15 at 14:18

1 Answers1

0

I've had the same problem with splinter and phantomjs. What worked for me was downloading phantomjs and adding it to the system path.

You can download phantomjs from here.

After extracting the contents of the file, copy the location of phantomjs (or phantomjs.exe if working on windows, like me) and add it to your system path. Directions on adding a folder to window's PATH are here.

Hope this helped.

bodu
  • 36
  • 3