The Web Spy has variety of options for XPath generation. Having a number of different approaches for generating XPath has its benefits. It gives Rapise incredible flexibility in getting the best results for different situations:

1. Sometimes we can recognize an element by its text. In such cases the simplest and most efficient XPath will use the node text.
2. Sometimes we have a regular structure (tables and grids) and it is better to have row and column indices inside the XPath.
3. Sometimes we deal with an application framework that uses custom attributes (e.g. aria, angular, bootstrap). So if we use them in our XPath then it will be cleaner and more robust.



The Web Spy currently supports the following different types of XPath:

·xpath_full - generates a fully featured XPath path using elements without attributes. This XPath starts with /html and goes through body and other elements towards the required node.
 

·xpath_min - generated with the attributes defined in the 'DOM Attributes Include Filter'. If the include filter is empty, then it is produced with all attributes except those defined in the 'DOM Attributes Exclude Filter'. For example, if the include filter contains the 'widgetid' custom attribute then the generated XPath would be:

//div[@widgetid="dojox_grid__View_1"]

 

·xpath_indexed - considers the node as nth of the same kind. For example, the page may contain 250 <a href=""> links across the page, and we want to learn the link somewhere in the middle. In this case indexed XPath will be of the form

 (//a)[123]

 

·xpath_std - generated and minimized with use of pre-selected set of attributes:

  • align
  • class
  • style
  • size
  • tabindex
  • value
  • width
  • height
  • colspan
  • rowspan
  • cellspacing
  • cellpadding
  • border
  • on* (i.e. onclick, onblur and so on)

Usually it contains most common attributes: id, name, for, role.
 

·xpath_aria - generated with the use of just the core id/name attributes plus the special aria attributes:

  • id
  • name
  • for
  • role
  • aria-*
     

 ·xpath_text - if possible, generated to match an HTML node simply by its text. For example,

<button>Refresh</button>

 is found by:

//button[normalize-space(text())="Refresh"]

In many cases this value is empty. This means that there are more than one node with such text.