Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Xpath based Identification in QTP 11.0
12-30-2011, 06:08 PM
Post: #1
Xpath based Identification in QTP 11.0

Xpath object identification is a new feature in QTP 11. Here is an example I would like to share.
Code:
Dim oPage  
Set oPage=Browser("name:=Google").Page("title:=Google")  
oPage.WebEdit("xpath:=//INPUT[@name='q']").Set "learnqtp" 'Entering value in Google textbox.  
oPage.WebButton("xpath:=//INPUT[@value='Google Search']").Click'Clicking Google Search button.

For those of you who doesn't know what an xpath is...
In simple terms its a unique address of a particular element in a webpage.
Find all posts by this user
Quote this message in a reply
01-08-2012, 01:51 PM
Post: #2
RE: Xpath based Identification in QTP 11.0
Hi Ravi,

could you please specify what are the advantages of using XPath identification rather than standard identification by either descriptive properties of the object in the code or using the object repository, if you use anyway, a property and a value for the identification in XPath (ex. value=Google Search)

Thanks Smile
Roy.

(12-30-2011 06:08 PM)ravi.gajul Wrote:  Xpath object identification is a new feature in QTP 11. Here is an example I would like to share.
Code:
Dim oPage  
Set oPage=Browser("name:=Google").Page("title:=Google")  
oPage.WebEdit("xpath:=//INPUT[@name='q']").Set "learnqtp" 'Entering value in Google textbox.  
oPage.WebButton("xpath:=//INPUT[@value='Google Search']").Click'Clicking Google Search button.

For those of you who doesn't know what an xpath is...
In simple terms its a unique address of a particular element in a webpage.
Find all posts by this user
Quote this message in a reply
01-08-2012, 05:41 PM
Post: #3
RE: Xpath based Identification in QTP 11.0
Xpath for a particular object is unique.We may think of it as an address location for a particular object which is unique.Hence object identification is easy.We need not look of multiple properties for unique identification of an object.In scenarios where properties doesn't make unique description , xpath makes the job easy and enhances performance(time spent in comparing multiple properties is saved).However performance depends on relative/absolute xpath given.Both paths point to the same object.
Hope this clarifies your query Smile
Find all posts by this user
Quote this message in a reply
01-09-2012, 11:41 AM
Post: #4
RE: Xpath based Identification in QTP 11.0
Hi,

Just another query: what would be more advantageous, Having xpath based identification of objects or html id?
Both will be unique I guess.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-09-2012, 03:03 PM
Post: #5
RE: Xpath based Identification in QTP 11.0
(01-09-2012 11:41 AM)Tarik Sheth Wrote:  Hi,

Just another query: what would be more advantageous, Having xpath based identification of objects or html id?
Both will be unique I guess.

I think if i understand Ravi correctly, I can summarize the difference between the standard property identification of QTP and XPath method:

Standard properties identifications (descriptive/OR) says to QTP:
"Go search for ALL objects in a specific hierarchy that match a set of property values, hopefully the properties match a single object"

XPath identification says to QTP:
"Hey! I'm here! (or not here), You have a direct reference to me!, no need to search for anything"

its kind of abstracted but hope this helps.

Roy.
Find all posts by this user
Quote this message in a reply
01-09-2012, 03:20 PM
Post: #6
Reinstallation within 8days
Hi ravi,
Is it Possible to reinstall qtp trial version with in 8 days?
As my installation was crashed.
Find all posts by this user
Quote this message in a reply
05-17-2012, 11:15 AM
Post: #7
RE: Xpath based Identification in QTP 11.0
Hi

shall u please tell me,how to work with webelement using Xpath
for example getroproperty of an webelement
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  QTP Support for IKVM based apps rbofarull 3 400 04-18-2012 11:48 PM
Last Post: akhi_s27
  Object Identification Issue for Client Server application in QTP 11 Prashanth Kichadi 5 1,298 07-19-2011 06:23 PM
Last Post: Prashanth Kichadi
  QTP invoke the Smart identification to identify the browser object SarodeGirish 1 2,227 01-12-2011 05:50 PM
Last Post: sreekanth chilam
  Does QTP support QT based applications? fox 1 1,242 08-02-2010 06:29 PM
Last Post: Saket
  QTP for TIBCO/GI based application monika_agrawal 1 769 09-10-2009 11:09 AM
Last Post: Saket

Forum Jump:


User(s) browsing this thread: 1 Guest(s)