scriptotek / alma-slipsomat

Tool for syncing Alma letters XSL files with a local folder
MIT License
15 stars 10 forks source link

geckodriver update causes slipsomat to bail #25

Closed th122 closed 7 years ago

th122 commented 7 years ago

Summary: yesterday everything was still working, today it's not. In between of course I did the usual "nothing": geckodriver got updated from 0.14.0 to 0.15.0.

At startup, a firefox window gets opened but not addressed. Once the window is open, slipsomat bails:

Traceback (most recent call last):
  File "/usr/local/bin/slipsomat", line 11, in <module>
    load_entry_point('slipsomat==0.1.0', 'console_scripts', 'slipsomat')()
  File "build/bdist.macosx-10.11-x86_64/egg/slipsomat/slipsomat.py", line 765, in main
  File "build/bdist.macosx-10.11-x86_64/egg/slipsomat/slipsomat.py", line 70, in __init__
  File "build/bdist.macosx-10.11-x86_64/egg/slipsomat/slipsomat.py", line 152, in connect
  File "build/bdist.macosx-10.11-x86_64/egg/slipsomat/slipsomat.py", line 130, in get_driver
  File "/usr/local/lib/python2.7/site-packages/selenium-3.0.2-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 150, in __init__
    keep_alive=True)
  File "/usr/local/lib/python2.7/site-packages/selenium-3.0.2-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python2.7/site-packages/selenium-3.0.2-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 180, in start_session
    self.session_id = response['sessionId']
KeyError: 'sessionId'

Here's the geckodriver.log:

1489502198399   geckodriver INFO    Listening on 127.0.0.1:49576
1489502199560   mozprofile::profile INFO    Using profile path /var/folders/sm/zs2yrj5n3839gr87qgxlbtgr0000gp/T/rust_mozprofile.xJ1Zx6cBEzpl
1489502199564   geckodriver::marionette INFO    Starting browser /Applications/Firefox.app/Contents/MacOS/firefox-bin with args []
1489502199593   geckodriver::marionette INFO    Connecting to Marionette on localhost:49585
1489502200837   Marionette  INFO    Listening on port 49585

Any ideas? I guess I'll try reverting to the previous geckodriver and see if that unbreaks things.

Tatjana

th122 commented 7 years ago

From the geckodriver release notes

IMPORTANT: If you use geckodriver with Selenium, you must upgrade to Selenium 3.3 since this release aligns HTTP responses with the WebDriver standard.

And of course it does seem to require code changes, as well:

All HTTP responses are now wrapped in {value: …} objects per the WebDriver specification; this may likely require you to update your client library

Looks like the common conundrum: remain backward-compatible or move ahead... ...Tatjana

th122 commented 7 years ago

Tried the other thing: updated selenium to 3.3.1. Things are looking better, buttest barfs and stalls.

works:

untried:

does not work:

From test:

slipsomat> test test-suite/Magazinzettel-AsienAfrika.xml
Testing XML file: test-suite/Magazinzettel-AsienAfrika.xml
full path: /Volumes/export/Alma/Letters/HUUB-Sandbox/test-data/test-suite/Magazinzettel-AsienAfrika.xml

Exception: Message: POST /session/666cb0da-6281-fc4b-ad19-3ea97deb3eff/file did not match a known command

Traceback (most recent call last):
  File "build/bdist.macosx-10.11-x86_64/egg/slipsomat/slipsomat.py", line 747, in execute
    function(self.browser, *args)
  File "build/bdist.macosx-10.11-x86_64/egg/slipsomat/slipsomat.py", line 677, in test_XML
    file_field.send_keys(path)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 345, in send_keys
    value = self._upload(local_file)
  File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py", line 548, in _upload
    raise e
WebDriverException: Message: POST /session/666cb0da-6281-fc4b-ad19-3ea97deb3eff/file did not match a known command

Press enter to restart browser:
danmichaelo commented 7 years ago

Thanks for starting to dig into this! I added the workaround described at http://stackoverflow.com/a/42770761/489916

Note that I added a new dependency (inquirer) in https://github.com/scriptotek/alma-slipsomat/commit/ccf43dd6f752cea5c04c45809a577a53129f7ead . Also, I attempted to fix the "element is not clickable" error that I still get every now and then. Probably not the end of the story.