SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    May 2001
    Posts
    389
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Question UFT, web add in, and XPath. Does anyone here work with this method?

    Hello friends.

    Does anyone work with UFT's web add in and the XPath property?
    In the object spy, there is a XPath option. When I look at it, it is nowhere like the xpath copied, while using the "copy xpath" method, from the browser's built in "Inspect Element" feature.
    So, could anyone please explain how this all works?

    How a short xpath from the browsers developer tools, is seen as a super large hierarchical string in UFT ??
    Example:

    //*[@id="z_v8_g5!cave"] - from the browser

    //DIV[@id="z_qu_g"]/DIV[1]/TABLE[2]/TBODY[1]/TR[1]/TD[3]/DIV[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/DIV[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/DIV[1]/DIV[1]/DIV[1]/TABLE[1]/TBODY[1]/TR[3]
    /TD[1]/TABLE[1]/TBODY[1]/TR[3]/TD[1]/DIV[1]/DIV[1]/DIV[1]/TABLE[1]/TBODY[1]/TR[11]/TD[1]/DIV[1] - from UFT 14.02


    Can someone explain this??
    Last edited by NoUse4aName; 03-19-2018 at 01:54 PM. Reason: Force line wrap.
    If it's working... don't touch it!

  2. #2
    Advanced Member
    Join Date
    May 2007
    Posts
    619
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    It's a difference in how they create the xpaths. The one from your browser found the ID for the tag you wanted and does a search for any tag with that ID. The one from UFT found a top-level DIV tag and walked through all the objects on the page down to the tag you want. Either one would get you the same object (assuming that the top-level DIV and path to the tag you want doesn't change each time the page loads). I highly recommend against using the UFT generated XPaths, though, because things do change.
    Dennis Belew

  3. #3
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,645
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    Quote Originally Posted by belewda View Post
    It's a difference in how they create the xpaths. The one from your browser found the ID for the tag you wanted and does a search for any tag with that ID. The one from UFT found a top-level DIV tag and walked through all the objects on the page down to the tag you want. Either one would get you the same object (assuming that the top-level DIV and path to the tag you want doesn't change each time the page loads). I highly recommend against using the UFT generated XPaths, though, because things do change.
    You seriously recommend that extremely brittle overly complicated xpath over just an available id?

  4. #4
    Advanced Member
    Join Date
    May 2007
    Posts
    619
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Nope, I recommend against using that.
    Dennis Belew

  5. #5
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,645
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    Lol my bad.

  6. #6
    Advanced Member
    Join Date
    May 2007
    Posts
    619
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Well, honestly, I guess it depends on your level of masochism. If that's your thing, UFT-generated xpaths are for you. I won't judge.
    Dennis Belew

  7. #7
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,645
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    Yeah just generally speaking identifiers generated automatically by whatever automation tool generally aren't the best and require manual tweaking. Not unique to UFT or xpath method.
    Last edited by NoUse4aName; 03-19-2018 at 01:52 PM.

  8. #8
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,847
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Often the short Xpaths will uniquely identify objects, however I use htlm id as the default, where not populated I use other props such as name, value, innertext.

    Xpath is lower down the pecking order and usually only used when an object is fully dynamic and you are forced to use some other method of identification.

    Mark Smith.

 

 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 12.00%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:21 PM.

Copyright BetaSoft Inc.