SafariWatir and textarea fields

08 Jul 2009

This is such a trivial patch that I'm almost embarrassed to post it. But, hey, perhaps it'll save someone five minutes. OK, so you're using SafariWatir to test your app and you need to put text in a text area. So you try:

browser.text_area(:id, 'reading_comment').set 'great book!'

and you get:

NoMethodError: undefined method `text_area' for <Watir::Safari:0x23c5850>

Just edit safariwatir-0.3.3/safariwatir.rb and add this at line 399:

class TextArea < TextField

and this at line 472:

def text_area(how, what), how, what)

Or just grab safariwatir.rb from here. Now, run your test again, and huzzah! The text area gets filled in one character at a time, just like a text field.