Xpath automation Approach
Knowledge of Xpath automation Approach
I saw this in a QTP job posting. What does it mean?
Using xpath identifiers instead of the "traditional" mappings in qtp. It has been used in Selenium for awhile and QTP added it with version 11 if I recall.
Xpath based Identification in QTP 11.0
Last edited by NoUse4aName; 08-24-2013 at 07:49 AM.
xpath is used as a locator in any xml or DOM based structure.
Besides HTML pages, it's also used for validating XML documents and SOAP web services.
easy way to validate the SOAP responses in UFT with user code in C#.
I understand how the XPATH syntax works and how to use it from reading the articles from NoUse4AName. How do we find out the xpath of the object?
Do we look at the source code, use a key combination(I forgot it) that shows the XPath, Firebug? F12 in IE?
How do I get to know what the path of the object is?
Can we ask qtp to learn the xpath when learning an object in the OR or when it is in record mode?
You can install xpath checker plugin for your browser (there's tons of them out there, which basically work in the same way). However, those will usually return a xpath using hard index, from there, you'll want to shorten the xpath using intelligent selectors.
Here's some tips on shortening xpath, Engineering Quality: 3 Useful Techniques to shortening your xpath
how would you code this xpath using DP?
Set obj_WebLink = Description.Create
obj_WebLink ("micclass").value = "Link"
obj_WebLink ("name").value= arrData(0)
Set oColl = Browser("micclass:=Browser").Page("micclass:=Page" ).ChildObjects(obj_WebLink)
iCount = oColl.Count
so instead of obj_WebLink ("name").value= arrData(0)
I want to use the xpath in the code
this is the xpath .//*[@id='Li1']/a
What if the tables/elements are generated dynamically...on the screen as per the parameters...
In thact case the given XPATH might be incorrect...