Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 63217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:35:52+00:00 2026-05-10T18:35:52+00:00

I have an Internet Explorer only web application. I’m exploring what we can do

  • 0

I have an Internet Explorer only web application.

I’m exploring what we can do to automate the testing.

Selenium looks like a good tool, but to be able to activate links etc. I need to tell it where they are. The application wasn’t built with this kind of testing in mind, so there generally aren’t id attributes on the key elements.

No problem, I think, I can use XPath expressions. But finding the correct XPath for, say, a button, is a royal pain if done by inspecting the source of the page.

With Firefox / Firebug, I can select the element then use ‘Copy XPath’ to get the expression.

I have the IE Developer Toolbar and it’s frustratingly close. I can click to select the element of interest and display all sorts of information about it. but I can’t see any convenient way of determining the XPath for it.

So is there any way of doing this with IE?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:35:53+00:00Added an answer on May 10, 2026 at 6:35 pm

    I would use bookmarklets. I have one XPath related, but I don’t know if it works in IE. I gotta go but I will test it and give it if it works on IE.

    Two bookmarklet sites for Web developers from my bookmarks: Subsimple’s bookmarklets and Squarefree’s Bookmarklets. Lot of useful things there…

    [EDIT] OK, I am back. The bookmarklet I had was for FF only, and wasn’t optimal. I finally rewrote it, although using ideas from the original one. Can’t find back where I found it.

    Expanded JS:

    function getNode(node) {   var nodeExpr = node.tagName;   if (nodeExpr == null)  // Eg. node = #text     return null;   if (node.id != '')   {     nodeExpr += '[@id='' + node.id + '']';     // We don't really need to go back up to //HTML, since IDs are supposed     // to be unique, so they are a good starting point.     return '/' + nodeExpr;   } // We don't really need this //~   if (node.className != '') //~   { //~     nodeExpr += '[@class='' + node.className + '']'; //~   }   // Find rank of node among its type in the parent   var rank = 1;   var ps = node.previousSibling;   while (ps != null)   {     if (ps.tagName == node.tagName)     {       rank++;     }     ps = ps.previousSibling;   }   if (rank > 1)   {     nodeExpr += '[' + rank + ']';   }   else   {     // First node of its kind at this level. Are there any others?     var ns = node.nextSibling;     while (ns != null)     {       if (ns.tagName == node.tagName)       {         // Yes, mark it as being the first one         nodeExpr += '[1]';         break;       }       ns = ns.nextSibling;     }   }   return nodeExpr; }  var currentNode; // Standard (?) if (window.getSelection != undefined)    currentNode = window.getSelection().anchorNode; // IE (if no selection, that's BODY) else    currentNode = document.selection.createRange().parentElement(); if (currentNode == null) {   alert('No selection');   return; } var path = []; // Walk up the Dom while (currentNode != undefined) {   var pe = getNode(currentNode);   if (pe != null)   {     path.push(pe);     if (pe.indexOf('@id') != -1)       break;  // Found an ID, no need to go upper, absolute path is OK   }   currentNode = currentNode.parentNode; } var xpath = '/' + path.reverse().join('/'); alert(xpath); // Copy to clipboard // IE if (window.clipboardData) clipboardData.setData('Text', xpath); // FF's code to handle clipboard is much more complex  // and might need to change prefs to allow changing the clipboard content. // I omit it here as it isn't part of the original request. 

    You have to select the element and activate the bookmarklet to get its XPath.

    Now, the bookmarklet versions (thanks to Bookmarklet Builder):

    IE
    (I had to break it in two parts, because IE doesn’t like very long bookmarklets (max size varies depending on IE versions!). You have to activate the first one (function def) then the second one. Tested with IE6.)

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

    FF

    javascript:function o__o(){function getNode(node){var nodeExpr=node.tagName;if(nodeExpr==null)return null;if(node.id!=''){nodeExpr+='[@id=''+node.id+'']';return '/'+nodeExpr;}var rank=1;var ps=node.previousSibling;while(ps!=null){if(ps.tagName==node.tagName){rank++;}ps=ps.previousSibling;}if(rank>1){nodeExpr+='['+rank+']';}else{var ns=node.nextSibling;while(ns!=null){if(ns.tagName==node.tagName){nodeExpr+='[1]';break;}ns=ns.nextSibling;}}return nodeExpr;}var currentNode=window.getSelection().anchorNode;if(currentNode==null){alert('No selection');return;}var path=[];while(currentNode!=undefined){var pe=getNode(currentNode);if(pe!=null){path.push(pe);if(pe.indexOf('@id')!=-1)break;}currentNode=currentNode.parentNode;}var xpath='/'+path.reverse().join('/');alert(xpath);}o__o(); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Related Questions

Loading...

Sidebar

Ask A Question

Stats

  • Questions 54k
  • Answers 54k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Current JavaScript From ES6 on you could use template strings:… May 11, 2026 at 7:28 am
  • added an answer When you use a global flag on a JS RegExp… May 11, 2026 at 7:28 am
  • added an answer It is as secure — forging the POST is equally… May 11, 2026 at 7:28 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.