QTP tutorial for beginners-QTP and Identifying Objects like an Expert 3

Considered the heart of QTP and Automation, the Object Repository is the brain that holds all object properties. QTP Tutorial recognizes the fact that non-mastery of the Object Repository feature will create problems in developing and testing applications. This video will focus on the mechanics of the Object Repository in identifying objects.

The Object Repository automatically adds test objects which are identified by a logical name (as assigned by QTP) which contain a set of properties that uniquely identify each object. The Object Repository has several features, one of which is “add object to local”. Using the Yahoo application, we added Mail and Web Edit, in which the hierarchy showed p. One of the unique functions of the Object Repository is that you can perform several actions, including renaming, thus, we renamed to Search Bar. It is important to use descriptive names to objects so you can easily identify them.

One of two types of Object Repository is the Local Object Repository. In the Local Object Repository, QTP automatically creates an object repository file for each action. In this case, only Action 1 can access Yahoo. You can add more objects in the repository so you can create and run tests under one action without modifying repository files.

Another feature of the Object Repository is “define test object”. This is used when the Object Spy could not properly identify object properties. Using the Record method, we came up with:

Browser(“Yahoo”).Page(“Yahoo”).Link(“Yahoo”)

To add a new test object, simply copy and paste properties as seen in the text format. Here we tried adding three properties: innertext, link and html tag. Unfortunately, all three yielded the same result – that the object does not have unique properties therefore, is not unique. It is important to note that having more properties for identification is not always better. The key is to find a combination of unique properties with unique values that will make the object unique. This is where the Ordinal Identifier enters the picture.

IDENTIFYING OBJECTS LIKE AN EXPERT PART 2I

IDENTIFYING OBJECTS LIKE AN EXPERT PART 4

Take a second to Tweet our site link. We appreciate your support!

  • Pingback: QTP tutorial, functions, vbscript, framework, automation, record and playback, object repository, basics, advanced |()

  • Pingback: QTP tutorial-Object identification like an expert part 2 -QTPtutorial.net |()

  • faseeha

    hey i have a question , my object spy is detecting any website on google chorme and one single element; Google Chrome, same case with object repository add feature. its working fine with windows explorer but not chrome, wonder why

  • faseeha

    i use UFT 11.5 and windows 8

  • Vera Nam

    ?: why all the identified objects are not recognized during the run. The message is saying :”Cannot find the “xxx” object’s parent “ABC”(class Browser).Verify that parent properties match an object currently displayed in your application….
    ?:what was done wrong?
    I added the objects then identified each of the objects in OR by highlighting it, then dragged them to the Action1 field – the script displayed. But the test failed.
    Thanks.

  • TK

    How do recognize object if object properties is dynamic? in other word every single time when i refresh the web page is displaying a new object property? Another question how do I insert value in drob box where i have to choose one? from the list?

    • QTPtutorialnet

      Hi. For the dynamic object, copy and paste all of the objects from the object spy tool 3 times after refreshing the page each time. This way I can see the way the object is change and give you a suggestion. And as for a drop down list, you can use a weblist object like here:

      Browser(“name:=browser page name”).Page(“title:=page title”).WebList(“Inntertext:=value”).Select “value”

      This is just an example, fill in the actual property values in the example above

      • TK

        Field itself looks like WebEdit. That’s property below:
        “Class Name:=WebEdit”,
        “abs_x:=2218”,
        “abs_y:=209”,
        “class:=ui-autocomplete-input ui-inputfield ui-widget ui-state-default ui-corner-all form-control ui-state-focus ui-state-hover”,
        “default value:=1000 – METAL MINING”,
        “disabled:=0”,
        “height:=34”,
        “html id:=selectGuarantorIndustryCodeModal:selectGuarantorIndustryCodeModalForm:sicCodePicker_input”,
        “html tag:=INPUT”,
        “innerhtml:=”,
        “innertext:=”,
        “kind:=singleline”,
        “max length:=2147483647”,
        “name:=selectGuarantorIndustryCodeModal:selectGuarantorIndustryCodeModalForm:sicCodePicker_input”,
        “outerhtml:=”,
        “outertext:=”,
        “pattern:=”,
        “placeholder:=Enter SIC code or description”,
        “readonly:=0”,
        “required:=False”,
        “rows:=0”,
        “title:=”,
        “type:=text”,
        “value:=”,
        “visible:=True”,
        “width:=568”,
        “width in characters:=20”,
        “x:=512”,
        “y:=103”
        When i try to Set(“Value”) it doesn’t inserting anything. I have tried to pull data from local and global data sheet and it doesn’t inserting anything.
        When i highlight console window using HTML ID it does highlight perfectly fine.

      • TK

        that’s actual UI.
        When I click 1 or letter it displays list of Item which is Web Element under Web table

      • TK

        These List of items

        • QTPtutorialnet

          So this web edit is an actual web list that had drop down properties? And the selections in the drop downs appear as web elements? If the selections appear as webelements, you can just identify each of those drop down selections as web elements instead of a we list. So if the first drop down value inner text value is 1 then you can do
          Webelement(“innertext:=1”).click

          Use the click method

          And can you send me
          The properties once the page is refreshed so I can see how they change?

          • TK

            When I identify this object appears to be webEdit. property below:
            “Class Name:=WebEdit”,
            “abs_x:=2218”,
            “abs_y:=209”,
            “class:=ui-autocomplete-input ui-inputfield ui-widget ui-state-default ui-corner-all form-control ui-state-hover”,
            “default value:=”,
            “disabled:=0”,
            “height:=34”,
            “html id:=selectGuarantorIndustryCodeModal:selectGuarantorIndustryCodeModalForm:sicCodePicker_input”,
            “html tag:=INPUT”,
            “innerhtml:=”,
            “innertext:=”,
            “kind:=singleline”,
            “max length:=2147483647”,
            “name:=selectGuarantorIndustryCodeModal:selectGuarantorIndustryCodeModalForm:sicCodePicker_input”,
            “outerhtml:=”,
            “outertext:=”,
            “pattern:=”,
            “placeholder:=Enter SIC code or description”,
            “readonly:=0”,
            “required:=False”,
            “rows:=0”,
            “title:=”,
            “type:=text”,
            “value:=”,
            “visible:=True”,
            “width:=568”,
            “width in characters:=20”,
            “x:=512”,
            “y:=103”

            After I have to enter value let say 1 or 2 and It displays list of Webelements which exist under WebTable. This propertie of just one of them(They are more then 100)

            “Class Name:=WebElement”,
            “abs_x:=2307”,
            “abs_y:=303”,
            “class:=”,
            “height:=30”,
            “html id:=”,
            “html tag:=TD”,
            “innerhtml:=IRON ORES”,
            “innertext:=IRON ORES”,
            “outerhtml:=IRON ORES”,
            “outertext:=IRON ORES”,
            “title:=”,
            “type:=”,
            “visible:=True”,
            “width:=479”,
            “x:=601”,
            “y:=197”

            So my question How to capture one of them in my testing.
            I already use :
            objbrowserpage.WebEdit(htmlId propertie).Set(Value) It didn’t work/ it seeing it but not inserting it.
            objbrowserpage.WebList(htmlid)
            didn’t work

            • QTPtutorialnet

              Can you send me the link to where this object is so I can work with it?

              • TK

                this is software we have been developing right now and it is available only for internal use. Thanks

              • QTPtutorialnet

                You said the drop down values appear as web elements correct? Then use the webelement click method on any of the objects in the drop down list. Make sure to identify each object in the drop down list. And as for the dynamic object that keeps changing, what are you referring to? Which object is changing when you refresh the page? And can you send me the object properties and values before and after you refresh the page? I need to see what is changing.

Pin It on Pinterest

Clef two-factor authentication