Dashboard > Watir > ... > Finding Page Elements > Multiple Attributes
Watir Log In View a printable version of the current page.
Multiple Attributes
Added by Zeljko, last edited by Charley Baker on Mar 10, 2008  (view change)
Labels: 
(None)

Multiple Attributes

I have more than one object of the same name. How do I commit an action on anything but the first one?

Lets imagine we have two 'Employees' links. This will click the first link that is found on the page:

$ie.link(:text, 'Employees').click

Use this syntax for the second (or more)

$ie.link(:text => 'Employees', :index  => 2).click

note: the above syntax is not yet implemented for input elements ("<INPUT>"), such as text_field, though it is supported for most other elements.

There is a JIRA ticket to add multiple attribute support for input elements, vote for it if you want to see it fixed. http://jira.openqa.org/browse/WTR-193

Go to contents, previous, next page.

Site running on a free Atlassian Confluence Community License granted to OpenQA. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.6 Build:#812 Aug 06, 2007) - Bug/feature request - Contact Administrators