Monday, June 17, 2013

QTP Descriptive Programming (DP) : Description Object - Creating Object with Descriptions


Description Object - Creating Object with Descriptions

'Description is an object which contains collection of properties, which identify any UI object such as a browser, a page, a dialog, a list, a button etc.

Set dialog_login = Description.create
dialog_login("text").value ="Login" ' Assigning "Login" value to "text" property to identify an object with this value.

'Creating a description object with two properties to uniquely identify the edit object in AUT
Set edit_agentname = Description.Create
edit_agentname("micClass").value = "WinEdit"
edit_agentname("attached text").value = "Agent Name:"

'Creating a description object with two properties to uniquely identify the edit object in AUT
Set edit_password = Description.Create 'Creating an object for WinEdit i.e. for text box
edit_password("micClass").value = "WinEdit"
edit_password("attached text").value = "Password:"

'Creating a description object with two properties to uniquely identify the button object in AUT
Set button_ok = Description.Create
button_ok("micClass").value = "WinButton"
button_ok("text").value ="OK"

Dialog(dialog_login).Activate
Dialog(dialog_login).WinEdit(edit_agentname).Set "Ravi"
Dialog(dialog_login).WinEdit(edit_password).Set "mercury"
Dialog(dialog_login).WinButton(button_ok).Click

No comments:

Post a Comment