Selenium’s ‘type’ command will not work with forms using TinyMCE for WYSIWYG markup. To test TinyMCE forms, you need to use ‘runScript’ to fire off some JavaScript to set the value.
First use mceFocus to get the textarea you wish to alter, in this case id=”body”:
tinyMCE.execCommand('mceFocus',false,'body');
Next, set the text by using mceInsertContent:
tinyMCE.execCommand("mceInsertContent", false, "body text");
In Selenium IDE:
tinyMCE.execCommand('mceFocus',false,'body');tinyMCE.execCommand("mceInsertContent", false, "body text");
So ‘body text’ will be inserted into the textarea with id ‘body’.
This doesn’t work
Sorry i was wrong, it does work ;p
I have multiple tinyMCE editors in many of my pages and I am wondering if there is a way to enter different test for each instance of tinyMCE based off something like the id for the iframe tag?
If you would, please let me know if you have know or seen anything like this. There is not much documentation concerning how to deal with tinyMCE outside of your information.
Thank you!
I have discovered another method to enter text into the tinyMCE text areas. This can be used for multiple instances on the same page.
Example:
type dom=document.getElementById(’mce_editor_0′).contentDocument.body
your text
For multiple instances you only need to modify the (’mce_editor_0′) to reflect the next instance.
I have also been able to use HTML with any text I am inputting.
Thanks!
Hi Sam
Thats looks like a good solution.
In the way I have written about, you just need to use tinyMCE.execCommand(’mceFocus’,false,’mce_editor_0′); to first get focus of the element you wish to manipulate.
tinyMCE.execCommand(’mceFocus’,false,’mce_editor_0′);
will put the focus on id=’mce_editor_0′
tinyMCE.execCommand(’mceFocus’,false,’mce_editor_1′);
will put the focus on id=’mce_editor_1′
Is that what you mean?
Awesome. It works perfectly.