Selenium hangs when launching Firefox on Ubuntu

邮差的信 提交于 2019-12-05 00:58:41

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

according to http://www.torkwrench.com/2011/12/16/d-bus-library-appears-to-be-incorrectly-set-up-failed-to-read-machine-uuid-failed-to-open-varlibdbusmachine-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!