Matt
Matt

Reputation: 53

Having trouble inputting into tinymce via selenium

In selenium i am trying to enter text into the tinymce text area, but i am having trouble selecting the text area to input the text. Is there a way to select the text area behind tinymce or anyway to select tinymce so i can enter text. thanks

Upvotes: 1

Views: 541

Answers (3)

helloiloveit
helloiloveit

Reputation: 179

    driver.execute_script("tinymce.get('{0}').focus()".format('id_of_textarea'))
    driver.execute_script("tinyMCE.activeEditor.setContent('{0}')".format('your text here'))

it works for me (cant remember where i saw it thought)

Upvotes: 0

ljavor
ljavor

Reputation: 116

Use command: runScript
Target: tinyMCE.get('text_area_id').setContent('Your text here')

or you can use tinyMCE.activeEditor.setContent('Your text here') which will select either the first or the last mceEditor, I forget..

Upvotes: 1

Thariama
Thariama

Reputation: 50832

You may use

tinymce.get('your_editor_id').focus();

In case you have one single editor on your page you may also use

tinymce.editors[0].focus();

Upvotes: 0

Related Questions