Webrat within selector

anyone know if/how webrat can scope a clicks_link within a selector?
eg, if I have more than one “Foo” link on a page, I want to make sure
I click the one within a specific div

Tia

linoj

On Oct 13, 2008, at 1:54 PM, Jonathan L. wrote:

anyone know if/how webrat can scope a clicks_link within a selector?
eg, if I have more than one “Foo” link on a page, I want to make
sure I click the one within a specific div

I’m pretty sure clicks link can also take an id. It’s not the
prettiest solution (in fact, I’m sure Bryan would say webrat was
developed to explicitly so that you wouldn’t use an id…but I
digress).

Scott

Jonathan,

This should work:

within “#user_43” do |scope|
scope.click_link “Edit”
end

If you’re using Rails’ record identification HTML helpers, you can do
something like within(’#’ + dom_id(user)) to save some typing.

Scott’s right that I’d recommend avoiding targeting IDs when possible,
but Webrat supports it in a few ways for cases where it’s needed.

-Bryan

On Mon, Oct 13, 2008 at 3:36 PM, Scott T.

thanks guys
yeah, my case is a step like When “I click on the $tab tab”… I want
to make sure its a link in a tab, not some other link on the page
with the same text