Tip to Find XPath in IE Browser

Find Xpath in IEWe often encounter a need to automate our application in IE browser. This may turn out a bit tricky as IE does not have tool or add-on like Firebug. You will have to write XPaths on your own. Or you can use this simple tip to find XPath in IE. This tip uses JavaScript to build IE bookmarklet for fetching an element XPath.

Follow below steps to find XPath in IE browser.

  • Open IE.
  • Type about:blank in address bar and hit Enter key.
  • Bookmark current page (Using Favorites –> Add to Favorites option or using CTRL+D keyboard shortcut).
  • Expand Favorites menu and locate your saved bookmark.
  • Right click on the saved bookmark and select Properties option.
  • Select Web Document tab from Properties dialog box and add below JavaScript code in URL box.
  • Save the bookmark.
  • Perform steps 2-4.
  • Add below JavaScript code in URL box of this newly created bookmark and save it.
  • Now, select an element(Eg. link, button, image, checkbox, text etc) for which you want to find XPath. Here select means clicking the left mouse button just before the element begins and dragging it till the element ends.
  • Select the first bookmark and second bookmark consecutively. Upon performing this step, element XPath gets copied to clipboard.
  • You can then paste the XPath in any editor (Eg. Notepad).

This is not a sure shot way to find XPath in IE browser. It has limitations in selecting web elements such as drop down values, hidden elements etc. However, it comes in handy for basic use. For more thorough automation, you should derive XPath yourself.

  1. Manoj
  2. Ed
  3. 初学者
  4. ravi
  5. Vikash Kumar

Leave a Reply

Your email address will not be published. Required fields are marked *