On Thu, Oct 11, 2012 at 10:48 AM, Adrian Killens <[email protected]>
wrote:
> Is it possible to use both and index and an id to get button?

Sure. Something like this:

browser.button(:id => "AddToBasket", :index => 0) # the first button with
id "one"

> e.g. if I had a 10 buttons all with the id "AddToBasket" could I use the
id and the index to just click the first of the 10?

Actually, this will click the first button

browser.button(:id => "AddToBasket").click

This too:

browser.button(:id => "AddToBasket", :index => 0).click

And this will click the second one:

browser.button(:id => "AddToBasket", :index => 1).click

By the way, ids should be unique on the page, you should let the developers
know.

Željko

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to