Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 799
Josh Avatar asked Aug 14 '12 19:08

Josh


People also ask

Which method is used to enter the text inside textbox in Selenium?

We can get the entered text from a textbox in Selenium webdriver. To obtain the value attribute of an element in the html document, we have to use the getAttribute() method. Then the value is passed as a parameter to the method. Let us consider a textbox where we entered some text and then want to get the entered text.

How do you press Enter in Selenium after entering text?

You can simulate hit Enter key by adding "\n" to the entered text. For example textField. sendKeys("text you type into field" + "\n") .

How do you get data from TinyMCE text editor?

The TinyMCE getContent and setContent methods You can do this using the getContent() API method. Let's say you have initialized the editor on a textarea with id=”myTextarea”. This will return the content in the editor marked up as HTML.


1 Answers

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

like image 168
Dejan Avatar answered Sep 28 '22 18:09

Dejan