Max Williams
2010-Mar-30 12:21 UTC
Selenium-client - get matching elements and their attributes
hi all
I''m using selenium-client with selenium rspec. I''m trying to
build a
helper method that will, given this html on the page...
<div id="flashes">
<p id="flash_notice" class="messages
notice">good things</p>
<p id="flash_errors" class="messages
errors">bad things</p>
<p id="flash_help" class="messages
help">helpful things</p>
</div>
...generate this hash:
{:notice => "good things", :errors => "bad things",
:help => "helpful
things"}
Ideally i''d like to keep it flexible so i don''t have to tell
it to
specifically look for notice, errors and help, but just pull out
whatever''s there in the flashes div.
I''ve been trying to do this using xpath selectors but am struggling
because, for example,
@browser.get_attribute("//div[@id=''flashes'']/p@id")
just returns the first p tag''s id, rather than an array of ids for
example. I get the feeling that i''m missing something fundamental.
grateful for any advice - max
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.