Xpath Generator for IE

can anyone suggest an xpath generator (free) for IE similar to xpather (http://xpath.alephzarro.com/) in firefox. I'm trying to use selenium, and the application I'm working on only opens in IE.

Is there an xpath generator for IE?

thanks

+4
source share
4 answers

This is almost a duplicate of fooobar.com/questions/423894 / ... , where @PhiLho provides an excellent answer - it provides "source code" for creating two letter letters for IE to get XPath in IE with just a few clicks.

However, it is worth mentioning here a very good Software Functional Test Automation blog post in which you will learn how to implement the PhiLho solution if you are less familiar with bookmarklets.

+4
source

I used a selector gadget with a link and love it:

http://www.selectorgadget.com/

I just tried this in IE8, and it seemed to me that this worked for me ... maybe this is a shot. Good luck

+2
source

In IE you need to install insatll Bookmarklets.

STEPS FOR INSTALLING BOOKMARKLETS

1) Open IE

2) Enter approximately: empty in the address bar and press enter

3) In the "Favorites" main menu, select ---> Add Favorites

4) In the Add Favorites window, enter the name GetXPATH1.

5) Click the add button in the add favorite popup window.

6) Open the "Favorites" menu and right-click on the newly added favorites and select the properties option.

7) GetXPATH1 properties will open. Select the Web Document tab.

8) In the URL field, enter the following:

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;}

9) Click OK. Press YES in the popup warning.

10) Add another favorite by following steps 3 through 5, Name this favorite GetXPATH2 (step4)

11) Repeat steps 6 and 7 for the GetXPATH2 that you just created.

12) Enter the following in the URL field for GetXPATH2

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();

13) Repeat step 9.

You are all done!

Now, to get XPATH elements, simply select the element with the mouse. This is due to clicking the left mouse button before the element (link, button, image, checkbox, text, etc.) starts and drags it to the end of the element. Once you do this, first select your favorite GetXPATH1 from the favorites menu, and then select your second favorite GetXPATH2. On his item you will receive a confirmation, press the access button. Now open the notepad file, right-click and select the paste option. This will give you the XPATH of the item you are looking for.

+1
source

About the script, to get IE xpath, this is great. However, it is not as simple as Firebug on Firefox. About a script in IE, it is almost impossible to get the xpath or xpath send button inside a frame (e.g. iframe).

Just wondering if the new version of IE will have good xpath support.

0
source

Source: https://habr.com/ru/post/1342594/


All Articles