Name and Text

Consider the following Application Under Test (AUT):

Order Form

Each item in the Managed object tree has Name and Text:

Name and Text

Normally, when Rapise learns an Object then element names are used for creating location path:

Learned category

And trailing part of the path is Name of the object's element.

Note: An object name is detected by the heuristics. In this case heruistics knows that an element is a label so it assumes that its text may be used (in most cases labels contain static text) and checking this text becomes an additional object matching creteria.

In this case it is worth to update object location to reflect its semantics (set object ID to Category and element name is lblCategory):

Updated Category

As far as object matcher thinks that element't Text is an Object Name we should Ignore Object Name to true so it keeps working when Text changes.

byname

byname locator allows finding managed object by element name.

Element name in this case is lblCategory (last part of the learned locator). So in the example above we can modify the locator to use byname:

Category By Name

There is an extended syntax for the byname locator. We may use byname:N to say that the search should not go deeper than N element tree levels. Default depth level is 10.

So if we do: byname:5 it should not go to deep and work faster. If we do byname:15 it will go further in the elements tree and may work slower, but should find deeply nested widget.

bytext

There is another control on the same page: button OK. We need it to close the dialog and it has steady name:

Button OK

It may be found wiht bytext locator as follows:

Button OK bytext

Combined Values

Rapise recorder tries to minimize unique values for the recorded object. For example, if object text is the same as object name then text one refers to name using param:object_name. If you want to use specific value then you may simply change param:object_name with actual value. I.e. &OK.

APIs

Each managed object has 2 entry points to enable recursive search:

DoFindByName(textOrRegexp, depth) Find nested element by its text (Value, Name of each element are compared with specified text or regular expression). See this Help Topic for reference.

DoFindByText(textOrRegexp, depth) Find nested element by its text (Value, Name of each element are compared with specified text or regular expression). See this Help Topic for reference.

Example usage:

// Find inbut box by name txtOrder and read its value
var orderTxt = SeS('Dialog').DoFindByName('txtOrder', 10);
Tester.Message('Order value: '+orderTxt.GetValue());

// Find button 'OK' and click.
var okBtn = SeS('Dialog').DoFindByText('regex:.*OK.*', 10);
okBtn.DoClick();