Google

Object Identification in WATIR

1. Object Identification means Identifying an object with their unique identity. It is independent of the data contained in the object.
2. Watir is not a Record and Play Back tool. So we need to pass the properties(mutiple if necessary) to the script to identify objects of the application.
3. Watir supports mutiple properties.
4. Watir supports "index" property for unique identification.
a) If an application contians two or more objects with same properties, then identification can be done with index.
b) Object can also identified by index when all objects are considered as Web objects.

Male
Male
Female
Above we have 3 Radio button's, 2 radio buttons with same NAME property "Male". Now to set to male radio buttons, the script should be

To set first male radio :
a) ie.radio(:name=>"Male" ,:index=>1).set OR
b) ie.radio(:index, 1).set
To set second male radio :
a) ie.radio(:name=>"Male" ,:index=>2).set OR
b) ie.radio(:index, 2).set
To set Female radio:
a) ie.radio(:name,"Female").set OR
b) ie.radio(:index, 3).set

No comments: