This is link to TinyMCE redactor: TinyMCE
I have a task: To type text in the textfield of TinyMCE开发者_Python百科. But this in not a textfield, this is a Body that doesn't have a method "TypeText();"
Please show me the code example, that can type the text in the TinyMCE Body
string js = "tinyMCE.activeEditor.setContent('tekst');";
browser.Eval(js);
tinyMce and watin don't play well together.
I generally have to use a combination of javascript (using browser.eval
) and the setAttributeValue('value')
of textfield
objects.
You could set the Text property of the Body element.
I was in a similar scenario (different editor / same concept) and got the body text set via javascript
string js = "document.getElementById('theEditor').contentWindow.document.body.innerHTML = 'Hello World!';";
myEditorPage.RichTextEditor.Eval(js);
Notes about the above code
- 'theEditor' is the ID of the editor frame.
- myEditorPage is a Page class I created
- RichTextEditor is the Frame object in my page class that corresponds to the 'theEditor' IDed frame.
Works like a champ.
My scenario
- IE8
- Win7
- Watin2.0
- Some 3rd party editor I don't remember.
精彩评论