How to enter text into tinymce text area using Selenium RC for Eclipse Java

Josh picture Josh · Aug 14, 2012 · Viewed 8.2k times · Source

I'm currently trying to automate test cases where I need to enter values for a required Text Area field.

The text area uses TinyMCE 3.4.9

I found a blog online that suggested selectFrame (iFrame containing tinymce) focus (tinymce) type (tinymce, text)

that didn't help since Selenium RC can't locate the iframe. However, I tried this with the Firefox plugin and at the very least I can select the iframe and focus the editor, but I can't enter any text. With RC, nothing I do seems to work

I also tried entering text using the html editor. So selenium can emulate clicking the button to open the html editor, then RC would either fail to find the text area or I'll get an error such that the element is no longer attached to the DOM (something along that line)

Sorry if this sounds confusing.

Answer

Dejan picture Dejan · Nov 27, 2012

This worked for me:

command: runScript target: tinyMCE.activeEditor.setContent('Replace with your text')

Got it from http://www.tinymce.com/forum/viewtopic.php?id=27960