Selenium hangs when launching Firefox on Ubuntu
The problem seems to be when running in a headless environment. If you don't have a window for it to render your browser in, it will hang. You can test this by pasting the same command when you ssh into your machine, but instead do ssh -X me@server.com
I found this documentation on what you can do to fix this:http://www.alittlemadness.com/2008/03/05/running-selenium-headless/
I had the same problem too and none of the solutions I found worked:
- No issue with the firefox executable path
- Headless display was already running
- There was no issue with browser profile
What I did, was try to run firefox manually (after setting the DISPLAY) - upon which I got the error:
D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open /var/lib/dbus/machine-id
I had no idea how this issue occurred out of the blue, but it was relatively simple to fix:
dbus-uuidgen > /var/lib/dbus/machine-id