There are several problems here.

- The attributes of an html object aren't meant to be in any particular
order; them changing is not really a bug.
- Using a regexp to parse html is a fundamentally broken idea.
- Why are you passing a third argument to #radio at all if you are just
getting that value from the html, corresponding to the same element you are
trying to retrieve? why not just do ie.radio(:name, 'anniversaryDate') ?

The error message isn't great, that is true. I would recommend to open a
ticket for that at http://jira.openqa.org/browse/WTR


On Fri, Sep 3, 2010 at 15:34, Lisa Crispin <[email protected]> wrote:

> I had a script fail when running it on IE8, it's several years old and
> works fine on IE7. It's setting a radio button:
> ie.radio(:name, 'anniversaryDate', anniversary_date).set
> The value of anniversary_date is a date like '10-01-2008' (at least, in
> IE7), it's set by using regex to parse the html
>   anniv_regex = /id=anniversaryDate(\d+).*?value="?(.+?)"? name=/
>
> In IE7 the html looks like this:
> <input type="radio" value="10-01-1992" name="anniversaryDate"
> id="anniversaryDate1">
>
> In IE8 the html looks like this:
> <input name="anniversaryDate" id="anniversaryDate1" type="radio"
> value="10-01-1992"/>
>
> In IE7, the value of anniversary_date ends up as: 10-01-2010
> In IE8, the value of anniversary_date ends up as: 10-01-2010 type=radio
>
> And I get an error "Watir::Exception::UnknownObjectException: Unable to
> locate element, using :name, "anniversaryDate"
>     C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:56:in
> `assert_exists'
>     C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:288:in
> `enabled?'
>     C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:60:in
> `assert_enabled'
>
> C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/input_elements.rb:538:in
> `set'"
>
> But in IRB if I type ie.radio(:name, 'anniversaryDate', '10-01-2010').set
> it works fine - so it's not that it can't find the name, the value is wrong.
>
>
> So one problem is a weird IE8 thing, I don't know what to do about that.
> But the other problem is, the error message is misleading. I wasted some
> time thinking something was wrong with the name.
>
> Thanks
> Lisa
>
> --
> Lisa Crispin
> Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers
> and Agile Teams_ (Addison-Wesley 2009)
> Contributor to _Beautiful Testing_ (O'Reilly 2009)
> http://lisacrispin.com
> @lisacrispin on Twitter
>
>  --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> You received this message because you are subscribed to
> http://groups.google.com/group/watir-general
> To post: [email protected]
> To unsubscribe: 
> [email protected]<watir-general%[email protected]>
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe: [email protected]

Reply via email to