python-myusps icon indicating copy to clipboard operation
python-myusps copied to clipboard

PhantomJS support depreciated in Selenium- Remove support?

Open nshores opened this issue 7 years ago • 2 comments

PhantomJS does not function correctly in the bundled version, or current version of Selenium in a Linux environment. It is still working on windows, but I suggest removing support for it entirely to keep version conflicts between OS at a minimum. A timeout occurs when called, as well as a warning.


Taceback (most recent call last):
  File "/home/nshores/.local/lib/python3.5/site-packages/myusps/__init__.py", line 180, in _login
    WebDriverWait(driver, LOGIN_TIMEOUT).until(EC.title_is(WELCOME_TITLE))
  File "/home/nshores/.local/lib/python3.5/site-packages/selenium/webdriver/support/wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nshores/.local/lib/python3.5/site-packages/myusps/__init__.py", line 300, in get_session
    _login(session)
  File "/home/nshores/.local/lib/python3.5/site-packages/myusps/__init__.py", line 182, in _login
    raise USPSError('login failed')
myusps.USPSError: login `failed

By default myusps.get_session is passing ('driver='phantomjs') unless otherwise specified by invocation. I believe we should remove support for PhantomJS entirley but defaulting to Chrome, and removing the check in _get_driver(driver_type): . I will be submitting a pull request shortly.

nshores avatar Apr 10 '18 16:04 nshores

PhantomJS should only be used for RaspberryPi users since Selenium isn't available as far as I understand as you can see a note from @happyleavesaoc here.

brianjking avatar Apr 16 '18 19:04 brianjking

PhantomJS is a web driver that Selenium can use. In the current setup, Selenium is used for authentication and cookie creation regardless of web driver (Chrome or PhantomJS). It appears with the current build of Selenium PhantomJS support is not working at all, plus we have an official note from the deverloper of PhantomJS that he is stepping down -- https://groups.google.com/forum/m/#!topic/phantomjs/9aI5d-LDuNE

There's also a note when you run Selenium about the same thing.

/usr/local/lib/python3.6/dist-packages/selenium/webdriver/phantomjs/webdriver.py:49: UserWarning: Selenium support for Phantom
JS has been deprecated, please use headless versions of Chrome or Firefox instead
  warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless '

There's no reason we shouldn't be able to use headless chrome on any Rasberry pi running Rasbian. There's a quick start here on how to use it - https://www.raspberrypi.org/forums/viewtopic.php?t=194176

nshores avatar Apr 16 '18 22:04 nshores