Monday, October 10, 2011

Xpath Based QTP Object Identification

Xpath object identification is a new feature in QTP 11. I would like to share an example for it using Google web page

Dim oPage

Set oPage=Browser("name:=Google").Page("title:=Google")

oPage.WebEdit("xpath:=//INPUT[@name='q']").Set "advancedqtp"'Entering value in Google textbox.

oPage.WebButton("xpath:=//INPUT[@value='Google Search']").Click'Clicking Google Search button.

Try it and enjoy

6 comments:

  1. Hi,

    Any input on how to get a xpath value using QTP 11, when we spy our application we are not getting any xpath value in the property list. Please le me know is there any other approach to get the xpath value from QTP 11.

    Thanks in advance.

    ReplyDelete
  2. Please answer the above question.

    Any input on how to get a xpath value using QTP 11, when we spy our application we are not getting any xpath value in the property list. Please le me know is there any other approach to get the xpath value from QTP 11.

    Thanks in advance.

    ReplyDelete

    ReplyDelete
  3. QuickTest uses XPATH/CSS identifiers only when identifying objects and not when
    learning objects. Therefore, they are not available from the Object Spy or
    the Object Identification dialog box.You can add an object using Add object to local, and then for complex web objects to be identified more accurately you can add Xpath or CSS property after adding the object to Local and deleting Ordinal Identifiers.While learning the object you cannot find the Xpath or css property.

    ReplyDelete
  4. Hi,

    For more Information on this follow below Blogspot:

    http://learnuft.blogspot.in/


    Regards

    ReplyDelete
  5. Hi,
    This is Firoz, currently working on XPATH and CSS in QTP.
    Here is How I Do:
    In QTP we dont have direct facility to find the XPath for an object. We have another method called IE Developer Tool Bar, That is as follows :
    Click F12 in IE or Chrome. This shortcut(F12) is for IEDeveloper Tool bar.
    A new window will be opened clearly showing the html view of the current page ...
    A Pointer tip will be there. Click on the Pointer and goto your object and click on it. while hovering only you will get a border line surrounding your object.
    then apply xpath or css using these properties.
    for more information contact me : firozshaik27@yahoo.com

    ReplyDelete
  6. Hi All,

    I want to know that can i use XPATH for locating elements in QTP-10, specially QTP-10, if yes please share your taught s and example.

    Regards
    Shivanand H

    ReplyDelete