Black Pepper Blog

The thoughts and musings of our team

Tag >> Selenium

I wrote an entry previously about manipulating a GWT RichTextArea widget via Selenium. Recently I've been investigating moving to Selenium 2, also known as Selenium WebDriver.

As with Selenium 1 the mechanism for manipulating a RichTextArea widget in Selenium 2:

  1. Select the iframe that the RichTextArea resides in
  2. Type the required text into the body of the iframe
  3. Select the top level frame

Assuming a RichTextArea with an ID of "gwt-debug-text-editor" the following Java code fragment gives a concrete example of doing this


I have been writing a Selenium test for a GWT application, which on the whole has been working really well.  The only fly in the ointment was manipulating a GWT RichTextArea widget.

 A RichTextArea is not a standard HTML input component, rather it is emulated by the GWT framework, therefore the normal SeleniumRC method of type() doesn't work when applied to the RichTextArea directly. After some reading and experimentation it can be done as follows:

  1. Select the iframe that the RichTextArea resides in
  2. Type the required text into the body of the iframe
  3. Select the top level frame

 Assuming a RichTextArea with an ID of "gwt-debug-text-editor" the following Java code fragment gives a concrete example of doing this


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.