XPath Recognition Property

The XPath recognition property allows you to identify and navigate to an element in an HTML document, using a path like notation (similar to URLs).

You can edit the XPath calculated by Automation Studio. Typically, you only need to change this value when there is no stable ID or Name.

XPath notation supports the traversing of elements using the logical + and - operators.

The XPath recognition property is only available for the Generic HTML connector.

The following example shows the XPath calculated for the Email text box field.

Using Predicates with XPath

(From version 7.8)

Predicates are logical expressions written in square brackets, used to find a specific element, or set of elements. Using predicates can provide you with a clearer, more efficient selection path.

You can only use predicates if you are not using any other recognition property.

Examples:

Predicate

Description

Example

*[index]

Selects all nodes, regardless of name, at the specified index.

doc[0]/div[2]/*[2]/*[0]

node[*]

Selects all nodes with a specified name, regardless of index.

doc[0]/div[2]/a[*]/div[*]

node[index]

Selects a node with a specified index.

doc[0]/div[2]/a[2]/div[0]

node[last()]

Selects the last node with a specified name.

doc[*]/div[last()]/a[2]/div[0]

node[last() - num]

Selects the last node with a specified name offset by num.

doc[*]/div[last()-num]/a[2]/div[0]

node[position() < x]

Selects nodes with an index less than x.

doc[*]/div[position()<x]/a[2]/div[0]

node[position() > x]

Selects nodes with an index greater than x.

doc[*]/div[position()>x]/a[2]/div[0]

node[position() = x]

Selects nodes with an index equal to x.

doc[*]/div[position()=x]/a[2]/div[0]

NOT

Logical NOT operator.

div[NOT last()]

OR

Logical OR operator.

div[last() OR (position()=1)]

AND

Logical AND operator.

div[last() AND (position()=1)]

node[@AttName]

Selects nodes with a specified attribute.

node[@id]

node[@AttName='value']

Selects nodes with an attribute set to a specified value.

node[@class='myClass']

node[@AttName=contains('value')]

Selects nodes where the attribute name contains a substring. Wildcards are not supported.

node[@class=contains('btn')]

node[@AttName=starts-with('value')]

Selects nodes where the attribute value starts with a specified value.

node[@class=starts-with('btn')]

node[@AttName=ends-with('value')]

Selects nodes where the attribute value ends with a specified value.

node[@class=ends-with('blue')]