Pre-General Availability: 2024-09-02

View an Element's XPath

The recorder identifies the XML Path Language, or XPath, of the element that a robot takes action on. You can view an element's XPath at any time from within a robot action and from your internet browser.

You typically need to view an element's XPath for the following situations:

  • The recorder is unable to target the exact element that you require.

    Get the XPath value yourself, and manually paste the value into the recorder.

  • A robot has suddenly started failing, and you need to determine whether the HTML for the page has changed.

View an XPath from a Browser

These instructions are for the Google Chrome browser.

  1. In a Google Chrome browser, right-click any element on a web page, and select Inspect.

    The developer tools appear.

  2. Ensure that the Elements tab is selected.

    This tab shows you the Document Object Model (DOM) of the web page. The DOM represents the web page as nodes and objects and allow the recorder and other tools to interact with the page. You can review the DOM to determine how a UI element is coded.

  3. On the Elements tab of the developer tools, right-click any node or object, point to Copy, and select Copy XPath.

    To see the value, paste into any text editor.

View an XPath from the Robot Canvas

  1. Open a robot.

    1. In the navigation pane, select Projects.

    2. Select the project name.

    3. In the left toolbar, select Robot Robot.
    4. In the Robots box, select the robot to open.

      The canvas appears.

  2. Along the toolbar, select Targets Targets.

  3. Select any target.

  4. Select Edit Edit icon.

    A panel appears.

  5. View the XPath value in the Locator field.

View an XPath within a Robot Action

  1. Open a robot.

    1. In the navigation pane, select Projects.

    2. Select the project name.

    3. In the Robots box, select the robot to open.

      The canvas appears.

  2. Double-click any action.

    The panel for the robot action appears.

  3. Select within the Locator field, and select Show target selector Show target selector.

    The Target selector field appears below the Locator field. This field shows the XPath value for the target, prefaced by xpath:.

Paste an XPath into a Locator Field

  1. Complete any of the previous steps to view an XPath value, and copy the value.
  2. Paste the value into a Locator field in a robot action.
  3. Preface the value with xpath:.

    For instance, for the following XPath:

    //*[@id="buttonName"]

    Enter the following value:

    xpath://*[@id="buttonName"]