Welcome to the new Ranorex Support Portal

The path editor

The path editor is the second main working environment in Ranorex Spy. It’s where you specify and edit the RanoreXPath of identified UI elements from the element tree. The path editor has several helpful functions to assist you in creating RanoreXPaths that fit your needs.

On this page, you’ll find out how the path editor works and what functions it offers.

In this chapter

Access the path editor


You can access the path editor in two ways: from the working environment selector within Spy, or directly from an opened repository.

From Spy

  1. In the element tree, select a UI element.

  2. In the working environment selector, click PATH EDITOR.

  3. The path editor working environment appears with the UI element highlighted in the path tree section.

From a repository

1

In a repository, select a repository item and…

a

…click EDIT IN SPY.

b

…right-click it and click Edit in Spy….

Element could not be found


A common error message that occurs when opening a UI element in the path editor as explained above is that the element couldn’t be found. This usually happens because the application containing the UI element isn’t currently running.

Initial situation

  1. In a repository, select a repository item.

  2. Click EDIT IN SPY.

  3. The path editor opens with an error message and the path tree displays red marks, indicating that the respective UI elements specified by the RanoreXPath could not be found.

Could not find element error
  1. Red symbols indicating that the respective UI elements specified by the RanoreXPath could not be found.

  2. Error message in the status bar of Spy indicating that the UI element could not be found.

Solution

  1. Start the application containing the UI element(s).

  2. In the path editor, click the Refresh button to update the references to the UI elements.

Locked tree steps


When opening a repository item in the path editor, its parent repository item limits what part of the RanoreXPath you can edit and what UI elements you can track. Any components of the RanoreXPath that specify the parent and above cannot be edited. UI elements at the same level or above the parent cannot be tracked.

This is because changes at these locked levels would affect other repository items and potentially break existing RanoreXPaths. If you need to make changes to the parent repository item or above, edit those items specifically.

  1. EDIT IN SPY opens the repository item for editing in the path editor.

  2. The changes you can make to the RanoreXPath are limited by the parent repository item.

  1. The browser & results working environment displays the repository item in the element tree.

  2. The parent of the repository item has been set as the root element automatically. This element represents the limit for tracking and editing.

  3. In the path editor, all elements above and including the root element are locked for tracking and editing.

  4. All items below the root element can be tracked and edited.

Path editor working environment


The path editor working environment consists of the two basic Spy sections (red frame), two specific path editor sections (green frame), and a status indicator (orange frame).

  1. Track button and RanoreXPath field. Explained in >Introduction.

  2. Working environment selector

  3. Path tree
    Displays the components of a UI element’s RanoreXPath in a tree structure.
    Refresh: Updates the tree to reflect changes in the respective application.
    Highlight: Highlights the UI element in the respective application.
    Both fail if the application isn’t running.

  4. Attribute specification
    Lists available UI-element attributes, operators, and values for use in the RanoreXPath.

  5. Status indicator
    Indicates how many UI elements the current RanoreXPath identifies.

Edit the RanoreXPath


The main application of the path editor is to support you in editing the RanoreXPath so as to make it more general or specific, depending on your needs. The section where you make the actual changes to the path is the RanoreXPath field. We’ve touched on it in the introduction to this chapter, but we’ll go into more detail here. Depending on whether you edit a UI element from the element tree or an already existing repository item from a repository, editing is a little different.

When editing UI elements from the element tree, the path editor functions more like a search and allows you to easily see what UI elements a given RanoreXPath will identify. You can consider it a sandbox environment that doesn’t affect your test, unless you start adding identified UI elements to your repository.

When editing existing repository items, you change your test. Therefore, the RanoreXPath field is a little more complex when doing so, as shown in the image below:

  1. The main yellow field is where you edit the RanoreXPath.

  2. The line below it displays the currently applied (valid) RanoreXPath specification, i.e. as it was before you started making changes.

  3. Parts of the RanoreXPath may be grayed out in the yellow field. This indicates they are locked and cannot be edited (see topic Locked tree steps further above).

  4. The APPLY button replaces the currently applied RanoreXPath (lower line) with the currently edited RanoreXPath (yellow field), closes Spy and returns to Ranorex Studio, where you will see the new path reflected in the repository item.

RanoreXPath syntax support

RanoreXPath syntax is fairly complex. The path editor has built-in syntax support to make editing easier.

  1. While editing aRanoreXPath, press Ctrl+Space.

  2. A drop-down list opens with semantically possible RanoreXPath syntax parts.

Selecting/deselecting path components

Using the path tree, you can easily include or exclude specific components from a RanoreXPath. Simply select or deselect them and the path will be updated automatically. However, there are some limitations (see below).

  1. Checkboxes to select/deselect path components

Try the following to see the effect this has:

  1. Select a component. It’s included in the RanoreXPath.

  2. Deselect the component. It’s excluded from the RanoreXPath, but also loses information, i.e. the adapter type and attribute.

  3. Re-select the component. The lost information is not recovered; the component is now a placeholder for any UI elements between the tabpage and radiobutton .

If information is lost this way, you can either retrack the UI element or add the information again manually.

Tree context menu

The context menu for components in the path tree lets you specify them in several ways:

  1. Optional (?)
    Declares the component as optional, indicated by a ? in the RanoreXPath before the modified component. When a component is optional, it isn’t required for the path to work, i.e. the path will still work if nothing is found for the component. When placed between an adapter and an attribute, both become optional, meaning the path will work if both, just one, or neither identify a UI element.

  2. Axis
    Axes are relationship operators. They allow you to select UI elements by way of their relation to other UI elements.
    Possible axes:

childSelects all children of the current node.
descendant-or-selfSelects all descendants (children, grandchildren, etc.) of the current node, and the node itself.
ancestorSelects all ancestors (parents, grandparents, etc.) of the current node.
selfSelects the current node.
descendantSelects all descendants (children, grandchildren, etc.) of the current node.
parentSelects the parent of the current node.
ancestor-or-selfSelects all ancestors (parents, grandparents, etc.) of the current node, and the current node itself.
preceding-siblingSelects all siblings before the current node.
following-siblingSelects all siblings after the current node.
Download

Further reading


Optional components and axes are part of RanoreXPath and explained in

Ranorex Studio advanced > ⇢ RanoreXPath.

  1. Node name

Allows you to assign a specific adapter to an element.

Download

Further reading


Adapters, attributes, and values are explained in

Ranorex Studio advanced > ⇢ UI elements.

USERS LOVE US

SUBSCRIBE TO OUR NEWSLETTER

Get the latest test automation information right in your mailbox.

FOLLOW US

© 2024 Ranorex GmbH. All Rights Reserved