By giving the description in form of the string arguments.
This is a more commonly used method for Descriptive Programming. You
can describe an object directly in a statement by specifying
property:=value pairs describing the object instead of specifying an
object’s name.
The general syntax is:
TestObject("PropertyName1:=PropertyValue1", "..." , "PropertyNameX:=PropertyValueX")
TestObject—the test object class could be WebEdit, WebRadioGroup etc….
PropertyName:=PropertyValue—the
test object property and its value. Each property:=value pair should be
separated by commas and quotation marks. Note that you can enter a
variable name as the property value if you want to find an object based
on property values you retrieve during a run session.
Consider the HTML Code given below:
<--!input type="”textbox”" name="”txt_Name”"--> <--!input type="”radio”" name="”txt_Name”"-->
Now to refer to the textbox the statement would be as given below
Browser(“Browser”).Page(“Page”).WebEdit(“Name:=txt_Name”,”html tag:=INPUT”).set “Test”
And to refer to the radio button the statement would be as given below
Browser(“Browser”).Page(“Page”).WebRadioGroup(“Name:=txt_Name”,”html tag:=INPUT”).set “Test”
If we refer to them as a web element then we will have to distinguish between the 2 using the index property
Browser(“Browser”).Page(“Page”).WebElement(“Name:=txt_Name”,”html tag:=INPUT”,”Index:=0”).set “Test” ‘ Refers to the textbox Browser(“Browser”).Page(“Page”).WebElement(“Name:=txt_Name”,”html
tag:=INPUT”,”Index:=1”).set “Test” ‘ Refers to the radio button
|