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.
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.
You can simulate hit Enter key by adding "\n" to the entered text. For example textField. sendKeys("text you type into field" + "\n") .
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With