8.2. The "Find Element" dialog box

This dialog box allows to select nodes specified using an XPath expression. This dialog box has a Simple tab which allows to perform most common search tasks without having to learn XPath. Arbitrarily complex XPath expressions are specified using the Advanced tab.

The search starts at explicitly selected node, if any, and at implicitly selected element otherwise.

8.2.1. The "Simple" tab

Example 1: find element having attribute id equals to introduction:

  1. Select "First in document". Make sure the Element field is empty.

  2. Check Having attribute. Type "id" in the text field. Select "Equals to". Type "introduction" in the next text field.

  3. Make sure Containing text is not checked.

  4. Click OK.

Example 2: navigate from element para to next element para:

  1. Click at the very beginning of your document.

  2. Select "Following current node". Type "para" in the Element field.

  3. Make sure Having attribute is not checked.

  4. Make sure Containing text is not checked.

  5. Click OK.

  6. Press Ctrl+A (command Find Element is repeatable) to move to next para, if any.

Example 3: find element html:pre having a class attribute and containing some text matching regular expression "print\w+\(":

  1. Select "First in document". Type "html:pre" in the Element field.

    If the namespace corresponding to prefix "html" is the default namespace of the document, it is also possible to simply type "pre".

  2. Check Having attribute. Type "class" in the text field. Make sure the next text field is empty.

  3. Check Containing text. Select "Matching RE". Type "print\w+\(" in the text field.

  4. Click OK.

8.2.2. The "Advanced" tab

Specify an XPath expression in the corresponding text field.

This expression is evaluated in the context of the explicitly selected node, if any, and in the context of the implicitly selected element otherwise.

The evaluation of the XPath expression must return a nodeset. If this nodeset exclusively contains contiguous siblings, all the nodes in the nodeset are selected. Otherwise, first node (in document order) of the nodeset is selected.

If the evaluation of the expression returns attributes, the corresponding elements are selected.

It is not possible to select the document node or sibling nodes of the root element.