redsquirrel / safariwatir

Watir for Safari

Home Page:http://wiki.openqa.org/display/WTR/SafariWatir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't locate by name with nested array

napcs opened this issue · comments

Given the site http://www.pastie.org/

and the form field

 <textarea class="pastebox" cols="40" id="paste_body" name="paste[body]" rows="22" tabindex="20"></textarea>

this test fails:

 require 'watir'
 b = Watir::Safari.new
 b.goto "http://www.pastie.org"
 b.text_field(:name, "paste[body]").set "Foo"

You get

Watir::Exception::UnknownObjectException: Unable to locate TextField element with id of paste_name
from /usr/local/lib/ruby/gems/1.8/gems/safariwatir-0.3.5/lib/safariwatir/scripter.rb:521:in execute' from /usr/local/lib/ruby/gems/1.8/gems/safariwatir-0.3.5/lib/safariwatir/scripter.rb:174:infocus'
from /usr/local/lib/ruby/gems/1.8/gems/safariwatir-0.3.5/lib/safariwatir.rb:382:in `set'
from (irb):7

However it works if you address it by id.

 b.text_field(:id, "paste_body").set "Foo"

Although you do see this:

  => :missing_value

and I don't know what that's supposed to mean :)

Started looking through the source code and I had no idea why this wouldn't work. This is still the case with the gem I built today from github (0.3.5)