There
are two ways to create Descriptive programming:
1.
By
using description objects
2.
By
using description Strings.
By
using description objects:
By using this approach we create a
description object and define the properties and values for identification.
‘Create
Description object
Dim
btnObj
Set
btnObj=Description.Create
btnObj(“Class
Name”).value=”WinButton”
btnObj(“text”)
=”OK”
Using
above created DP object in script:
Dialog(“text:=Login”).WinButton(btnObj).Click
Script: Write a Script for Login by using
description objects concept
By
using Description Strings:
By using this method of descriptive
programming we don’t need to create a
description object, instead we use a description string to recognize the
objects.
It means that we are maintaining object
properties and their values in script itself.
Ex:
Dialog(“text:=Login”).WinButton(“text:=OK”).click
Converting
an OR based script to DP based script:
OR based script:
Dialog(“Login”).Activate
Dialog(“Login”).WinEdit(“Agent
Name:”).set “james”
Dialog(“Login”).WinEdit(“Password:”).set
“mercury”
Dialog(“Login”).WinButton(“OK”).click
DP based script:
Script: Write a Script for Login
by using description strings concept
Dialog(“text:=Login”).Activate
Dialog(“text:=Login”).WinEdit(“text:=Agent
Name:”).set “james”
Dialog(“text:=Login”).WinEdit(“text:=Password:”).set
“mercury”
Dialog(“text:=Login”).WinButton(“text:=OK”).click
If Window(“Text:=Flight Reservation”).Exist
Then
Window(“Text:=Flight
Reservation”).Close
End
IF
Contributed by: Vamshi Gowtham
m.vamsigowtham@gmail.com
m.vamsigowtham@gmail.com