3

I want to run selenium tests on a Hudson slave.
The slave (i.e. the machine) that will execute the selenium is a Ubuntu 10.04.
Thus it has Gnome. Selenium needs a firefox to run.

What Hudson does now is, it creates a ssh connection to the Ubuntu machine and launches selenium there. Selenium tries to start a firefox.

And now it blames:

Error: cannot open display

What needs to be done that the 'ssh shell' gets a display from the X-server?

Caleb
  • 12,121
  • 4
  • 39
  • 49
nebenmir
  • 133
  • 1
  • 1
  • 3

5 Answers5

2

Make sure that the remote machine has ssh X11 forwarding enabled:

$ grep X11 /etc/ssh/sshd_config 
X11Forwarding yes
X11DisplayOffset 10
$

Use ssh -X user@remote_machine to connect to remote machine. If on remote machine you are using a different user to start the X client, use xauth list to get the current credentials in the ssh user, then use xauth add to add the credentials to the user you are becoming with sudo/su.

read -p 'Username: ' u;sudo -H -u $u xauth add $(xauth list|grep :$(echo ${DISPLAY: -4:2}));sudo su - $u
1

If the question is what I think it is

ssh testuser@ubuntuhost firefox --display :0 -no-remote

Will start firefox on ubuntuhost and have it display on that machine, assuming testuser is logged on to ubuntuhost already.

I don't know Selenium, or what exactly you're looking to test (performance, correctness of display, or simply a success return value from some javascript) but you might not even need a 'real' X server, i.e. one that actually appears on the monitor of the Ubuntu host. Xvfb might be helpful for you here, but that's beyond the scope of the original question...

Norky
  • 869
  • 4
  • 14
0

You need to enable X forwarding, and run an X server locally. Pass -X or -Y to ssh.

0

ssh -X root@myserver or something like that

0

You need to forward X over the ssh tunnel, try this:

ssh -X host_IP

once logged in, start firefox in your terminal, it should forward your X-server to your local machine.

tw79
  • 31