12-30-2011, 06:08 PM
Xpath object identification is a new feature in QTP 11. Here is an example I would like to share.
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.
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.