Closed btbonval closed 10 years ago
herpy derp. Second link basically says to do the same thing as first link: install virtual X frame buffer.
virtual X frame buffer causes firefox to throw RANDR and GLIBC errors.
Xlib: extension "RANDR" missing on display ":99".
(firefox:6774): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Error spawning command line `dbus-launch --autolaunch=5f2d14c8d7f9175323e7d9be000000e4 --binary-syntax --close-stderr': Failed to execute child process "dbus-launch" (No such file or directory)
Been looking into fixes, but this seems strangely broken for something so many people seem to do.
Bunch of stack overflows that don't work for many people (including me): http://stackoverflow.com/questions/12644001/how-to-add-the-missing-randr-extension http://stackoverflow.com/questions/17944234/xlib-extension-randr-missing-on-display-21-trying-to-run-headless-googl http://stackoverflow.com/questions/19662732/how-to-get-selenium-and-xvfb-to-work-in-ubuntu http://stackoverflow.com/questions/20190225/javafx-xvfb-yet-another-xlib-extension-randr-missing-on-display-99?rq=1
Something a bit more pythonic, but ultimately a similar answer: http://coreygoldberg.blogspot.com/2011/06/python-headless-selenium-webdriver.html
sudo apt-get install xvfb firefox
pip install pyvirtualdisplay
modify test_selenium.py:
from pyvirtualdisplay import Display
Display(visible=0, size=(1024, 768)).start()
----------------------------------------------------------------------
Ran 28 tests in 160.909s
OK
WOOPWOOP
The fix for this ticket is clearly the above, but I'm not sure if hardcoding the headless support would mess with @charlesconnell dev environment.
For now, I leave this open as a TODO for the VM. Maybe I'll have the Vagrant file patch the selenium python file or something like that. Needs some discussion I suspect.
If btbonval's snippet is the fix, where to apply it to? where do I find test_selenium.py?
https://github.com/FinalsClub/karmaworld/blob/master/karmaworld/apps/courses/test/test_selenium.py
Right at the top of the file (after the imports)
See the Corey Goldberg link above as well. The code snippet comes from there.
thanks
Fix for headless selenium testing is documented above if it is ever needed again.
Actually I'm unsure how we perform any kind of testing lacking any development systems, so it seems kind of irrelevant. Closing this ticket.
This was super helpful. Thank you.
The dev VM has no GUI, so Firefox will have to run headless (if that is even a thing).
Otherwise, this error occurs:
possible fix from 2008 to run a virtual X frame buffer: http://www.alittlemadness.com/2008/03/05/running-selenium-headless/
Here is a post about using Selenium WebDriver for headless testing with Firefox and Ubuntu (our use case): http://www.installationpage.com/selenium/how-to-run-selenium-headless-firefox-in-ubuntu/
WebDriver info (appears to be part of Selenium 2.0): http://docs.seleniumhq.org/projects/webdriver/
Python's selenium bindings are already for WebDriver? https://pypi.python.org/pypi/selenium