Simulating Typing into a GWT RichTextArea with SeleniumRC

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

import com.thoughtworks.selenium.Selenium;
private final Selenium selenium;
public void typeIntoRichTextArea()
    selenium.type("//html/body", "This is some example text to type into the text area");

Hopefully this will save some one else from having to find this out the hard way!

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.