Dashboard > Watir > ... > Finding Page Elements > Index
Watir Log In View a printable version of the current page.
Index
Added by Zeljko, last edited by Zeljko on Feb 14, 2008  (view change) show comment
Labels: 
(None)

Index

Elements on a web page can be accessed by where they appear on a page. If an element you want to interact with always appears in the same place, you can access it by a one-based index. Here's an example using a radio list:

What you see in the web browser:

Radio 1:
Radio 2:
Radio 3:

Watir code to set the first radio list item using its index:

ie.radio(:index, 1).set

Watir code to clear the second radio list item using its index:

ie.radio(:index, 2).clear
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