Kurt Russell
Kurt Russell

Reputation: 235

How can I click the button with same id?

I have two buttons with the same id's (everything is identically). If I click it, it choose automaticly the first button, but I need to click the second oder third.

@b.link(:id => "commit").click

Upvotes: 1

Views: 173

Answers (1)

Željko Filipin
Željko Filipin

Reputation: 57312

id should be unique on the page, you should report this as a bug.

In the meantime, to click the second link with the same id try this:

@b.a(:id => "commit", :index => 1).click

To click the third one:

@b.a(:id => "commit", :index => 2).click

By the way, you can click the first one with:

@b.a(:id => "commit", :index => 0).click

Upvotes: 1

Related Questions