Forum closed. New forum available at

setting wymeditor textarea value for testing

Support forum for WYMeditor.

setting wymeditor textarea value for testing

Postby rbmoore on Thu Jan 10, 2008 8:05 pm

i am writing automated tests for a page containing two wymeditor textareas using watir ( i need to set a string value in the editors so that i can fill out and submit a form. here is what i am trying and can't seem to get it to work:

Code: Select all
ff.text_field(:name,"license[description]").value = "some description"

this does not actually set the value in the field.

the html for this field is:

Code: Select all
<textarea id="license_description" class="wymeditor" rows="20" name="license[description]" cols="40" style="display: none;"/>

i can also access the field using element_by_xpath.


Posts: 2
Joined: Thu Jan 10, 2008 7:53 pm

found a solution

Postby rbmoore on Fri Jan 11, 2008 6:12 pm

for anyone else out there testing wymeditor using watir tests, here is what i found that works:

by first click on the ToggleHtml button you get an accessible textarea to put text into.

Code: Select all

ff.element_by_xpath("//table[@class='content_edit']/tbody/tr[8]").link(:name, "ToggleHtml").click

populate(ff.element_by_xpath("//table[@class='content_edit']/tbody/tr[8]").text_field(:class, "wym_html_val"), "some new text here")

populate method is:
Code: Select all
def populate(field, text = nil)   
    puts('populate() - Field: ' +
    puts("populate() - Setting field to value: " + text)
    field.value = ""
    if (text != nil)
      field.value = text
      if (field.value != text)
   raise ArgumentError, "After setting field value, value does not match: " + text, caller
      puts('Field text was passed as nil')

hope this helps.
Posts: 2
Joined: Thu Jan 10, 2008 7:53 pm

Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests