-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Python 3.4+, Selenium 3.3 and Firefox 52esr #143
Conversation
PIL is not a dependency of OpenWPM proper, so it would be inappropriate to list it in requirements.txt, but it _is_ used by one of the tests. Kludge a direct installation command into .travis.yml.
This should get us 90% of the way to Python 3 support.
This module was completely removed in Python 3.
This may mean install.sh now needs to install something called 'GeckoDriver', but let's see if we can get away without it.
Since Selenium 3.3 requires a 'geckodriver' executable in the PATH, put <root_dir>/firefox-bin in the PATH if it exists, and rely on PATH search to find 'firefox'.
* Replace Adblock Plus with uBlock Origin (which does not need precached filter lists) * Replace Ghostery with Disconnect (ditto) * Update HTTPS Everywhere to latest version
We _might_ be down to just HTTP instrumentation problems at this point.
The behavior of `open(path, "a+")` differs between Python 2 and Python 3. In the latter, it will try to seek to the end, and if this fails (e.g. if `path` is a pipe) it will throw an exception. To work around this we have to monkey-patch selenium.webdriver.firefox.service.Service.
sqlite3 fetchall() has always returned an array of tuples even when the query returns a single row; Python 2's sloppy cross-type comparisons let us get away with it.
Thanks so much for taking this on -- this has been a looming TODO I haven't been able to get started on. It may be a little while before I am able to review and further test your changes, but I just wanted to jump in now to say I appreciate the contribution. If you run into any issues or have any questions as you continue work on your project, please feel free to reach out. |
FWIW, Selenium 2.x has supported Python 3 for several years. |
The version that OpenWPM had pinned when I started this project (2.53) didn't. :-) |
This PR addresses issues #88, #92, #93, and maybe #101.
Selenium 2.x does not support Python 3, so it's necessary to bump the Selenium and Firefox versions, and that was actually the hardest part of the change. MITMProxy has been completely ripped out, but I kept the proxy_queue around in case it is desirable to add some other HTTP proxy in the future (it'll just always be None and do nothing). The only other dependency that hadn't been updated was PyAMF, which I forked and pruned down to just enough for what OpenWPM needs.
This passes the internal test suite, but it probably needs quite a bit more testing; I expect there is lots of stuff the internal test suite does not cover. I am happy to continue working with you on this, but I need to get back to the project that this is in aid of, so I may be slow, and I'm not going to do any more testing myself, beyond what my own project involves. Y'all are welcome to add patches on top of this, however is convenient for you. I may add patches on top of this if I turn up more problems in my own testing. (More bytes/str/unicode mixup bugs are practically certain to exist.)
TravisCI report for my branch: https://travis-ci.org/zackw/OpenWPM
Some notes on specific concerns from the issues and/or bits of the patch that may not seem obvious:
install.sh
copies geckodriver in there. If it doesn't exist, we go ahead and try to run system-installed firefox/geckodriver instead.