>

Difference between Index and Location

1.Difference between location and index with example.

a. Index- The order in which the objects appear on the source code with relative to other objects have same or identical properties.
For eg consider the below page which have 4 text boxes with identical properties but the index value is different for each of the object.

let us write the descriptive programming for each of the text box.
Depending on the order of the objects the index is assigned.

INDEX1

 

 

 

 

 

 

 

TextBox 1
Browser(“name:=.*”).Page(“title:=.*”).WebEdit(“name:=test”,”index:=0″).set “1”

TextBox 2
Browser(“name:=.*”).Page(“title:=.*”).WebEdit(“name:=test”,”index:=1″).set “2”

TextBox 3
Browser(“name:=.*”).Page(“title:=.*”).WebEdit(“name:=test”,”index:=2″).set “3”

TextBox 4
Browser(“name:=.*”).Page(“title:=.*”).WebEdit(“name:=test”,”index:=3″).set “4”

b.Location- The location of the object from top to bottom and from left to right with relative to other objects have same or identical properties.

INDEX1

note : TextBox 4 having location:=1  because it considers the location of the object from top to bottom first and then left to right where as the TextBox 4  index:=3

TextBox 1
Browser(“name:=.*”).Page(“title:=.*”).WebEdit(“name:=test”,”location:=0″).set “1”

TextBox 4
Browser(“name:=.*”).Page(“title:=.*”).WebEdit(“name:=test”,”location:=1″).set “2”

TextBox 2
Browser(“name:=.*”).Page(“title:=.*”).WebEdit(“name:=test”,”location:=2″).set “3”

TextBox 3
Browser(“name:=.*”).Page(“title:=.*”).WebEdit(“name:=test”,”location:=3″).set “4”

Leave a Reply