Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

An element can't be clicked when the browser controlled by Selenium is displayed through xvfb #5828

@lukeis

Description

@lukeis

Originally reported on Google Code with ID 5828

An area of the HTML page can't be clicked in a headless environment whereas it can in
a "headful" environment.

As you can see in the Xvfb screenshot (attached), the area inside the red rectangle
can't be clicked.

This bug depends on the system environment.
It occurs when the browser driven by Selenium server standalone is displayed through
`xvfb`.
The same click will work properly on the same system when the browser driven by Selenium
server standalone is displayed through an X11 (forwarded through SSH).

The bug occurs since version 2.33 of Selenium standalone server. It does not with versions
2.31 and 2.32.
The bug occurs with Firefox version 21. We don't know if it affects other versions
of Firefox.
The bug does not occur with Google Chrome.


== What is the specific environment?

=== Download the virtual machine

Here you can find a ready-to-use virtual machine for VirtualBox, so you can run all
tests you want in the environment that triggers the described bug.

[https://www.dropbox.com/s/uodcjnbembaqjuy/ubuntu_headless.ova]

The user is `test`, its password is `test`.

SSH is redirected on `localhost:2200`
HTTP is redirected on `localhost:8000`


=== Or install one yourself

If you can't get the virtual machine, the following steps allow to reproduce the environment:

* Install an Ubuntu server 12.04 x64 on a virtual machine.
* Install the following packages: `xvfb` `openjdk-7-jre` `x11-apps` `firefox`.
* Install Selenium server standalone version 2.33.

If your host machine is OS X, install xquartz to get the X11 forwarding working.

Follow these instructions to assert the environment setup:

The environment is really headless if:

* SSH on the virtual machine: `ssh <user>@<ubuntu-server>`
* Run `xclock`, it should fail with this kind of error: "Error: Can't open display:"

The X11 forwarding works if:

* SSH on the virtual machine with the X11 forwarding: `SSH -X user@ubuntu-server`
* Run `xclock`, it should display a clock in your host OS.

The environment can run graphical programs headlessly if:

* SSH on the virtual machine: `ssh <user>@<ubuntu-server>`
* Run `xvfb` in background: `xvfb :99 &`
* Set the current display to xvfb: `export DISPLAY=:99`
* Run `xclock`, it should not print anything, but it should not fail. Press Ctrl+C
to stop xclock after a few seconds.


== What steps will reproduce the problem?

I can reproduce the bug. I tried to extract a minimal test case from our corporate
source code but unfortunately I didn't succeed due to the size of dependencies.

I hope that running the selenium standalone test suite within the provided environment
could help to identify the problem and correct this bug.


== What is the expected output?

Through X11 forwarding:

When you click on one of the 12th line buttons (see attached screenshot), it works
properly.

Environment:

* SSH with the X11 forwarding: `ssh -X user@ubuntu-server`.
* Setup the good display: `export DISPLAY=localhost:10.0`.
* Start Selenium server from this shell session: `java -jar selenium-server-standalone.jar
> selenium.log`.

Now, Selenium server is displayed through the X11 forwarding. So when Selenium server
opens a browser you see it in your host OS.

Here is the server log:

{{{
16:39:02.957 INFO - Executing: [find element: By.selector: #sst table tbody tr:nth-child(10)
td:nth-child(2) a[data-for$="no"]] at URL: /session/0bd09de8-cc02-471e-85e6-fc693a756714/element)
16:39:02.966 INFO - Done: /session/0bd09de8-cc02-471e-85e6-fc693a756714/element
16:39:02.980 INFO - Executing: [click: 32 org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement@f98a3ea9]
at URL: /session/0bd09de8-cc02-471e-85e6-fc693a756714/element/32/click)
16:39:03.153 INFO - Done: /session/0bd09de8-cc02-471e-85e6-fc693a756714/element/32/click
}}}

== What do you see instead?

Through xvfb:

You can't click on one of the 12th line buttons (see attached screenshot).

Environment:

* SSH: `ssh <user>@<ubuntu-server>`
* Run xvfb in the background: `xvfb :99` (default screen size is 1280x1024)
* Setup the good display: `export DISPLAY=:99`
* Start Selenium server from this shell session: `java -jar selenium-server-standalone.jar
> selenium.log`

Now, your Selenium server is displayed through xvfb. So when Selenium server opens
a browser you do not see anything.

You will find the relevant server log excerpt attached.


== Please provide any additional information below.

The screen size affects the bug. With different screen sizes, the size of the non-clickable
area changes. It can get smaller or greater. (Run Xvfb with the -screen option to change
the display)

Reported by thomas.debona on 2013-06-25 07:48:41


- _Attachment: Xvfb screenshot.png
![Xvfb screenshot.png](https://storage.googleapis.com/google-code-attachments/selenium/issue-5828/comment-0/Xvfb screenshot.png)_ - _Attachment: [server_log.txt](https://storage.googleapis.com/google-code-attachments/selenium/issue-5828/comment-0/server_log.txt)_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions