Forum: RSpec Select box with Webrat

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0506f45fe389025e7028be36514142ea?d=identicon&s=25 mikej (Guest)
on 2009-04-22 16:16
(Received via mailing list)
I have a select box:

<select id="temp_aspect_topic_id" name="temp_aspect[topic_id]">
  <option value="">– Select Topic –</option>
  <option value="1">Pollution</option>
</select>

I would like to select the pollution option from the list using
webrat.

I've tried:

select "Pollution", :from => "temp_aspect[topic_id]"
select "Pollution"

In both cases I receive the error:

The 'Pollution' option was not found

Any suggestions much appreciated,

Mike
9c231b767e308e5823b9d0d78e77fc25?d=identicon&s=25 roovo (Guest)
on 2009-04-22 16:36
(Received via mailing list)
2009/4/22 mikej <mikejeremiah@gmail.com>

> I've tried:
>
> select "Pollution", :from => "temp_aspect[topic_id]"
> select "Pollution"


you should select by the id attribute, not the name attribute, so:

select "Pollution", :from => "temp_aspect_topic_id"

should work

-- roovo
0506f45fe389025e7028be36514142ea?d=identicon&s=25 mikej (Guest)
on 2009-04-23 14:54
(Received via mailing list)
Thanks for the response.  I think I tried that one, still get the
response:

The 'Pollution' option was not found in the "temp_aspect_topic_id"
select box (Webrat::NotFoundError)

Any more thought?

Mike
0506f45fe389025e7028be36514142ea?d=identicon&s=25 mikej (Guest)
on 2009-04-23 15:02
(Received via mailing list)
Thanks for the response.  I think I tried that one, still get the
response:

The 'Pollution' option was not found in the "temp_aspect_topic_id"
select box (Webrat::NotFoundError)

Any more thought?

Mike
F86901feca747abbb5c6c020362ef2e7?d=identicon&s=25 Zach Dennis (zdennis)
on 2009-04-23 18:14
(Received via mailing list)
On Thu, Apr 23, 2009 at 4:34 AM, mikej <mikejeremiah@gmail.com> wrote:
> Thanks for the response.  I think I tried that one, still get the
> response:
>
> The 'Pollution' option was not found in the "temp_aspect_topic_id"
> select box (Webrat::NotFoundError)
>
> Any more thought?

Do you only have one select box on the page with that id (hidden or
showing, maybe new and/or edit forms) ?

>
> Mike
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



--
Zach Dennis
http://www.continuousthinking.com (personal)
http://www.mutuallyhuman.com (hire me)
@zachdennis (twitter)
This topic is locked and can not be replied to.