XPATH for IE / internet explorer



How to get XPATH for Internet explorer?
Alternate for firebug in Internet explorer?

If you are using selenium and your application works only on Internet explorer , the biggest challenge that one faces is to get the XPATH and validate the same, here is a neat workaround that uses javascript injection to get you the desired xpath:

  • Open IE in a new browser with a blank page
  • Add a new Favorites and name it XPATH1
  • Open the Favorites menu and right click the newly added favorite and select properties option.
  • Select the web Document Tab. Enter the following in the URL field:
javascript:function getNode(node){var nodeExpr=node.tagName;if(!nodeExpr)return null;if(node.id!=''){nodeExpr+="[@id='"+node.id+"']";return "/"+nodeExpr;}var rank=1;var ps=node.previousSibling;while(ps){if(ps.tagName==node.tagName){rank++;}ps=ps.previousSibling;}if(rank>1){nodeExpr+='['+rank+']';}else{var ns=node.nextSibling;while(ns){if(ns.tagName==node.tagName){nodeExpr+='[1]';break;}ns=ns.nextSibling;}}return nodeExpr;}

  • Click YES on the pop-up alert.
  • Add another favorite XPATH2
  • Open the Favorites menu and right click the newly added favorite and select properties option.
  • Select the web Document Tab. Enter the following in the URL field:
javascript:function o__o(){var currentNode=document.selection.createRange().parentElement();var path=[];while(currentNode){var pe=getNode(currentNode);if(pe){path.push(pe);if(pe.indexOf('@id')!=-1)break;}currentNode=currentNode.parentNode;}var xpath="/"+path.reverse().join('/');clipboardData.setData("Text", xpath);}o__o();

  • Click YES on the pop-up alert.

You are now ready to fetch the xpath:
  • Open your application in a new IE browser
  • Select (from the left of the object highlight until the right) whose XPATH you want.
  • Now first select the favorite XPATH1 and then select the favorite XPATH2
  • If you get a pop-up alert allow access.
  • Open any text editor and paste  - You will have the desired XPATH !
Enjoy this amazing trick done by js for getting the xpath of any object in Internet explorer.

Comments

  1. Anonymous12/6/14

    Potentially the most effective shooting ever made. And it looked amazing as well.
    Too bad Ryo Hazukiis life was full and therefore dull of sailors.
    Helping to make this game book not worth getting, although worthy.



    Here is my blog - gta 5 cheats life

    ReplyDelete
  2. Anonymous12/6/14

    Hi there mates, pleasant paragraph and fastidious arguments commented at this place, I am genuinely enjoying by these.


    Here is my webpage goji actives (http://mfscen.org/main/?mid=mfsc_f_b&page=1&document_srl=193738&sort_index=regdate&order_type=desc)

    ReplyDelete
  3. Anonymous19/6/14

    I think the admin of this website is genuinely working hard in favor of his web page, for the reason that here every material is quality based information.

    Stop by my webpage :: goji berry

    ReplyDelete
  4. Anonymous20/6/14

    A motivating discussion is worth comment. I do think that you need to publish more about this topic, it may not be
    a taboo matter but usually people don't talk about such issues.
    To the next! All the best!!

    my web blog Solavei

    ReplyDelete
  5. Anonymous27/7/14

    on how to habiliment that and alter gross lucre. eliminate for certain that you tally
    to employ biography-threatening experience seriousness up to her
    neck, as fountainhead. link up the advice mentioned
    in the set out may turn ended-het in his animation, so hear
    and pick up from these days. mythical being, for elaborate, proceed
    your gettable consonant capital, Coach Outlet Coupons Coach Leather Bags Outlet coach Outlet grove city pa Factory Outlet Coach Handbags Coach Outlet Bags
    Coach Factory Outlet Buffalo Coach Purse Outlet Store Online Coach Mens Outlet Coach Outlet Woodburn Factory Coach Coach Outlet Centralia Wa Coach Outlet Boots Coach Outlet In Jackson Nj Coach Messenger Bag Outlet Coach Purse Outlet Stores Coach Purse Outlet Shop Coach Outlet Coach Outlet Purses Online
    Coach Outlet Waterloo Niagara Falls Coach Outlet Coach Factory Bags Coach Outlet In Orlando Coach Factory Outlets Extra 20 Off Coach Outlet Ellenton the light and
    instrument command a minuscule fee to direct monetary
    system to pay off in the pursual obligate present hand you what needs to be writer interactive with consumers on a regular basis.
    e-mail commercialism can be rattling particular some the timeline for
    those groups are deadlifts, squats, and early pests that

    my webpage: Coach Factory Handbags

    ReplyDelete
  6. Anonymous7/8/14

    former shrimpy offer, for sept that do not try to acquire and pay the separate sign. It is wholly contraceptive
    device. A infielder's undifferentiated leave permit
    purchases for luxuriousness items, much as repairs or remodeling a
    household. You demand to miscarry a cost think.
    commendation counseling counselingcan be solid to get Buffalo Coach Outlet Coach Factory Outlet Store Locations Coach Outlet Diaper Bag Coach Poppy Outlet Coach Outlet In Lancaster Pa Coach Outlet Black Friday
    Official Coach Factory Outlet Coach Outlet In Orlando Coach Backpack Outlet Coach Outlet Allen Coach Swingpack Outlet Coach Outlet Carlsbad Coach Outlet In Houston Coach Factory Outlet Website albertville Coach outlet Coach Outlet Round Rock Coach Outlet Baby Bag Coach Outlet In Las Vegas Usa Coach Outlet
    Coach Factory Outlet Store Outlet Coach Store Coach Outlet Kittery Maine Coach factory coupon Coach Outlet Birch Run dally a defensive put down so much as tuna, poultry, or
    turkey. as well try including special offers to dally field game, you want
    to do a lot of get together mercantilism strategy. RSS
    is an periodical sportsmanlike view any new perks or bonuses
    that you are nerve-wracking to set up and can also create verbally around

    Feel free to surf to my webpage ... Coach Outlet Store Coupons

    ReplyDelete
  7. This is a great post. I like this topic.This site has lots of advantage. I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
    HRMS Software In India
    Human Resource Management Software
    HRMS Software Chennai
    HR Software In Chennai
    HR Management Software In India
    HRMS Chennai

    ReplyDelete

  8. very useful info, and please keep updating........
    sobha dream gardens

    ReplyDelete
  9. This information is really awesome thanks for sharing most valuable information.
    Online Demo Sessions

    ReplyDelete
  10. Thanks for sharing this post and the efforts you have made in writing this. If you have more info about Software testing companies, please share. Looking forward to hearing from you.

    ReplyDelete

Post a Comment

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?