Object oriented Programming

HP QTP uses VB SCript programming for preparing Automation Script so in order to learn VB Script we require small knowledge of Object Oriented Programming.

Class: 

A class is a prototype from which objects are created.Here in HP QTP we are working on objects with out identifying the objects in application we can't execute the script in QTP.
Object is an instance of a class

Properties:


Properties are the characters of the objects where identifying the objects in the application under test.

Ex:

For a submit button developers will provide some properties to identify the objects and where we will use those properties to identify the objects in HP QTP.

Methods:


In HP QTP having different methods to identify the objects and those are built in functionalities for the objects.In VBScript script makes call to the methods to verify the objects.

Ex: Reporter.ReportEvent()

Below are the objects to identify in application and how to indicates in HP QTP


  1. Browser : Browser(""Browser name")
  2. Page : page("page name")
  3. Link : link("Link Name")
  4. Edit Box : WebEdit("Edit Box name")
  5. ListBox: Weblist("List Box name")
  6. Menu:Webmenu("Menu")
  7. Checkbox : WebCheckbox("Check box name")
  8. Button: WebButton("Button Name")
  9. Radiobuton: Webradiobutton("Radio button name")


Below are the scripts for some operations


  1. Active Window  - .Activate
  2. Enter text in Edit box - .set "name"
  3. Select item from list box - .select "item name"
  4. Enter password in Edit box - .setsecure"password"
  5. Close web application - .closealltabs
Ex:
Browser("Browser name").Page("Page name").WebEdit("Username").Set "rajesh"
Browser("Browser name").Page("Page name").WebEdit("Password").Setsecure "xxxxxx"

like this we can use the objects and scripts in HP QTP to identify the objects in application under test.

Post a Comment

0 Comments