Thursday, February 13, 2014

QTP / UFT - Object identification using XPath

Did you experience a situation where you had a WeElement that was visible only at mouse over, and UFT would not recognize it even if you pay for that?

Here is something to try:

1. Open site in Chrome browser.
2. Press F12 to see DevTools.
3. Go to the desired element, Right-click on it and select "Inspect Element".
4. The element will bie highlighted in the DevTools zone:
\
5. Copy XPath, and paste somewhere to use it, you should have something like this:

//*[@id="highcharts-0"]/svg

6. Enter the code in UFT. Should be something like:

 Browser("Browser_Local").Page("MyPage").WebElement("xpath:="//*[@id='highcharts-0']/svg"").Click

Hope this helps!

Note: Special thanks to my colleague Mihai, who pointed this out.

1 comment:

  1. Refer http://hokrani-softwarehub.blogspot.in/2014/05/isone-of-object-identification.html

    ReplyDelete