#290 new
Josh Nichols

'select' fails when trying to target options that contain HTML escapable characters

Reported by Josh Nichols | September 11th, 2009 @ 12:14 PM

I was trying to do something like:

select("(GMT-05:00) Eastern Time (US & Canada)", :from => "Time zone")

But it was always failing despite the existing and there being an appropriate . After digging around, I discovered the problem was here in webrat/core/locators/select_option_locator.rb:24

Webrat::XML.inner_html(o.element) == @option_text.to_s

The left hand side of this equality check was returning "(GMT-05:00) Eastern Time (US & Canada)" which != "(GMT-05:00) Eastern Time (US & Canada)".

I'm able to get this working by doing:

select(html_escape("(GMT-05:00) Eastern Time (US & Canada)"), :from => "Time zone")

However, this feels kinda nasty. Ideally, I shouldn't have to be HTML escaping the stuff I pass down into webrat.

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket