Friday, April 9, 2010

watir: Index: How to identify Index in ruby scripting?

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

No comments:

Post a Comment