On Sat, Jan 24, 2009 at 12:05 AM, Jonathan Linowes <[email protected]> wrote: > hiya, > > i want the selector that would return a <tr> of a table if any td contains > some text, so i can use it in click_link_within > > e.g. When I click the "show" link within the row containing > "[email protected]" > > > When /^I click the "(.+)" link within the row containing "(.+)"$/ do |link, > text| > selector = ?? > click_link_within selector, link > end
You can use an XPath selector to find the parent. Try: selector = "//table//tr//td[contains(.,'[email protected]')]//.." > > > ----------- > and lets say the response contains > > ... > <div class="table-container"> > <table> > <tbody> > <tr>...</tr> > <tr> > <td><a href="/posts/14">show</a></td> > <td>foo</td> > <td>bar</td> > <td>[email protected]</td> > <td>baz</td> > </tr> > <tr>...</tr> > </tbody> > </table> > </div> > ... > -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
