Skip to content Skip to sidebar Skip to footer

Phantomjs Issue On Mac With Jupyter Notebook

I’m trying to experiment with some code I found at the repo https://github.com/AlbanyCompSci/aeries-api basically to help me login in to this grade portal called aeries and pull

Solution 1:

This error message...

WebDriverException: Message: 'phantomjs.exe' executable needs to be in PATH.

...implies that the phantomjs.exe was not found in the specified location.

There seems to be a bit of messup as follows:

  • PhantomJS Browser itself is a headless web browser scriptable with JavaScript which can run on Windows, macOS, Linux, and FreeBSD. So you don't need to explicitly pass the argument headles and you can remove it.
  • You havn't mentioned about the underlying Operating System.
    • If you are on Linux 64 bit OS you need to download the phantomjs-2.1.1-linux-x86_64.tar.bz2 from Download PhantomJS, extract the binary and while mentioning the absolute path of the phantomjs binary you need to strip off the extension part (i.e. .exe)
    • If you are on Linux 32 bit OS you need to download the phantomjs-2.1.1-linux-i686.tar.bz2 from Download PhantomJS , extract the binary and while mentioning the absolute path of the phantomjs binary you need to strip off the extension part (i.e. .exe)
    • If you are on Mac OS X you need to download the phantomjs-2.1.1-macosx.zip from Download PhantomJS , extract the binary and while mentioning the absolute path of the phantomjs binary you need to strip off the extension part (i.e. .exe)
    • If you are on Windows OS you need to download the phantomjs-2.1.1-linux-x86_64.tar.bz2 from Download PhantomJS , extract the binary and while mentioning the path of the phantomjs binary you need to provide the absolute path including the extension (i.e. phantomjs.exe)
  • Though you observe the deprecation notice but the support is still there. So for the time being you can ignore the error:

    C:\Python\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py:49: UserWarning: Selenium support forPhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead
      warnings.warn('Selenium support forPhantomJS has been deprecated, please use headless '
    
  • On Windows8 system here is the working code:

    from selenium import webdriver
    
    driver = webdriver.PhantomJS(executable_path=r'C:\\Utility\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe')
    driver.get('https://www.google.com/')
    print(driver.title)
    driver.quit()
    
  • Console Output:

    C:\Python\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py:49: UserWarning: Selenium support forPhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead
      warnings.warn('Selenium support forPhantomJS has been deprecated, please use headless '
    Google
    

Post a Comment for "Phantomjs Issue On Mac With Jupyter Notebook"