Identify controls by anchor

To create stable, conclusive tests, you need to make sure that Tosca Cloud can reliably identify and interact with screen elements in your application ("controls").

There are different ways to identify controls. This topic takes you through identifying controls by anchor, where you identify a control by its location relative to other controls ("anchors").

Full disclosure: While this method will work for some use cases, we advise against using anchors for web applications. In a modern web context, it's typically too difficult to find anchors that are consistently stable.

Access this option

The option to identify controls by anchor is only available in the Advanced View of Tosca XScan.

Use this option

To identify a control by anchor in the Advanced View, follow these steps:

  1. Select the control you want to identify in the tree view of the scan. Then, select Identify by > Anchor from the ribbon menu.

  2. In the Identify By Anchor pane, choose an anchor in one of the following ways:

    • Drag and drop your anchor control from the tree onto the Anchor Control field.

    • Select Select From Tree View, select an anchor in the tree, and then select Enter.

    • Select Select on Screen, select an anchor control in your application, then use Select on Screen again to confirm.

  3. Optionally, choose a different algorithm from the Relative Algorithm dropdown:

    • ShortestPath: Starts the search with the child controls of the anchor, then extends the search to every tree level until it reaches the root element.

    • Coordinate: Uses the coordinates of the anchor to locate a search angle and find the control.

    If you stick with the default algorithm Auto, Tosca Cloud tries ShortestPath first and then switches to Coordinate if that doesn't work.

Considerations

When identifying controls by anchor, keep these things in mind:

  • The state of your implementation. Changes to your application's user interface might affect the relative positions of controls and anchors. If that happens after the scan, Tosca Cloud will have issues connecting anchors and control.

  • The screen resolution, color depth, or scrolling. Make sure that the user who scans the application has the same settings as the machine that runs your tests.

What's next

Identification by anchor not working for what you need? No problem—try properties, index, or images.

However, if you're happy with your module, then it's time to start creating tests.