This site uses cookies. Continue to use the site as normal if you are happy with this, or read more about cookies and how to manage them.

×

This site uses cookies. Continue to use the site as normal if you are happy with this, or read more about cookies and how to manage them.

×

Simulating Clicks on GWT Push Buttons with Selenium RC

I've come across an oddity in my functional tests for a GWT application I am working on.

The Selenium RC test I have should simulate a user clicking on a button, implemented as a GWT PushButton (com.google.gwt.user.client.ui.PushButton). The problem is that the click on the button never seemed to work using the following code:

selenium.click(BUTTON_ID);

A GWT PushButton is not a standard HTML <input type="submit" ...> or a <button ...> rather it is a styled button constructed from DIV and other HTML tags.

After some head scratching and experimentation it turns out that the click can be actioned using the following code.

selenium.mouseOver(BUTTON_ID);
selenium.mouseDown(BUTTON_ID);
selenium.mouseUp(BUTTON_ID);

Not exactly rocket science in the end, but it took a while to work out. Hopefully this will save someone else having to work it out from scratch!