New to Telerik Test Studio? Download free 30-day trial

Elements Find Expression

When an action is recorded against an element from a web page or WPF application, Test Studio generates a Find Expression, which is then used to locate that element in the application during execution. The same process is triggered if an element is explicitly added to the Elements repository from the DOM explorer.


The basic component of elements' Find Expressions in Test Studio is the FindClause - this is a name-value pair connected with a comparison operator. The Find Expression consists of at least one FindClause and this can be verified when editing the element.

Element's find expression

The 'name' portion of a FindClause pair can be any element's property that a certain technology (i.e. HTML, XAML) recognizes.

HTML Find Expression

  • Any valid attribute name (id, name, etc.)

  • TextContent - search for an element in which has text that matches the specified expression.

  • InnerText - search for an element in which the InnerText matches the specified expression.

  • InnerMarkup - search for an element in which the InnerMarkup matches the specified expression.

  • OuterMarkup - search for an element in which the OuterMarkup matches the specified expression.

  • StartTagContent - search for an element in which the StartTagContent matches the specified expression.

  • NodeIndexPath - search for an element having the specified NodeIndexPath.

  • TagName - search for an element in which the TagName matches the specified expression.

  • TagIndex - search for an element at the specified zero based TagIndex.

  • XPath - search for an element at the specified XPath expression.

XAML Find Expression

  • AutomationId - search for an element having an automation ID of a specific value.

  • TextContent - search for an element containing or not containing some text.

  • XamlTag - search for an element of a specific type.

  • XamlTagBase - search for an element that extends a specific type

  • Name - search for an element having a name of a specific value.

  • TagIndex - the zero based index value of a specific tag.

  • XamlPath - Uses a XAML path expression like XamlPath=/radtabcontrol[automationid=Tabs]/grid[0]/raddockpanel[0]/layouttransformcontrol[name=HeaderDockedElement]

Note! When editing an element in active recording session, all available element's properties will be listed and available for direct selection in the Find Expression.

Element's attributes

Comparison Operators

The available comparison operators for each FindClause are: 'is exactly', 'contains', 'does not contain', 'starts with', 'ends with', 'matches the regular expression', 'is missing' and 'exists'.

FindClause comparison operators

Element's Image

The find expression of elements in Test Studio is also enhanced with corresponding images - each recorded element gets an image recorded along with its automatically generated find expression. The image will be used as a backup search criteria in case the element's find clauses didn't match any element on the page.

Conditions to Fall Back to Find Elements by Image

The test execution flow remains unchanged. The enhancement is that when an element fails to be located on page with its find expression within the set Elements Timeout, Test Studio automatically falls back to the element image search and continues as expected if the element is found using the predefined image. The execution results contain warning that the element's find expression didn't match any element on page and it was found by image.

Modifying the Predefined Image

The recorded image for each element can be edited separately from the find expression.

Note! Switching the Elements Edit pane to modify the image settings or recording new image, requires to save any current changes in the same element's Find Expression.

Basic Concept

The main idea, when choosing the proper FindClauses and what comparison to apply, is to build a find expression, which points uniquely to a single element in the active application. Test Studio analyze the DOM tree and the structure of elements in it and strives to generate a unique find expression based on the current DOM tree.

  • For HTML application Test Studio relies on the Find Logic criteria list and its particular order. This can be adjusted on project level.

  • For hierarchical controls such as TreeViews, Test Studio creates chained find expressions.

  • Use unique elements' attributes, which are not dynamically generated to ensure a single element in the application will be pointed by this find expression.

In this article
Not finding the help you need? Improve this article