0

I'm trying to use selenium from python but I'm having a problem running it on a RHEL5.5 server. I don't seem to be able to really start firefox.

from selenium import webdriver
b = webdriver.Firefox()

On my laptop with ubuntu this works fine and it starts a brings up a firefox window. When I log in to the server with ssh I can run firefox from the command line and get it displayed on my laptop. It is clearly firefox from the server since it has the RHEL5.5 home page.

When I run the python script above on the server it (or run it in ipython) the script hangs at webdriver.Firefox()

I have also tried

from selenium import webdriver
fb = webdriver.FirefoxProfile()
fb.native_events_enabled=True
b=webdriver.Firefox(fb)

Which also hangs on the final line there.

I'm using python2.7 installed in /opt/python2.7. In installed selenium with /opt/python2.7/pip-2.7.

I can see the firefox process on the server with top and it is using a lot of CPU. I can also see from /proc/#/environ that the DISPLAY is set to localhost:10.0 which seems right.

How can I get a browser started with selenium on RHEL5.5? How can I figure out why Firefox is not starting?

Brian C.
  • 6,455
  • 3
  • 32
  • 42
  • How is your environment set up? The server is headless and you are connecting to some X server instance to get a GUI on your laptop, right? When you say you can launch firefox from the terminal on the server and it shows up on your laptop, are you running it from a separate terminal-only ssh client, or running it from a terminal instance running in the remote GUI session? When you run python/selenium, what user is it running as, and are you sure it is configured to work with the GUI instance for your remote client? What happens if you try to run it from a terminal in the remote GUI? – Silas Ray Oct 24 '12 at 18:28
  • The server is headless and I'm connecting to it with ssh -X and I'm using a laptop with X. I'm using the same terminal session to the server for starting Firefox from the command line,which works and shows up on my laptop, and for running the python script, which doesn't work. The script is running as my user. – Brian C. Oct 24 '12 at 18:41

1 Answers1

0

It looks like the problem I'm encountering is this selenium bug: http://code.google.com/p/selenium/issues/detail?id=2852

I used the fix described in comment #9 http://code.google.com/p/selenium/issues/detail?id=2852#c9

That worked for me.

Brian C.
  • 6,455
  • 3
  • 32
  • 42