Seapine Labs
Personal tools

Resolve the 'Cannot locate the repository item in the running application' error

From Seapine Labs

Jump to: navigation, search

After recording a new script, it fails during playback with an error message similar to the following:

"Cannot locate the local:WysiCorp Login/1.0/Wysicorp - Feedback Acknowledgement/editbox8 repository item in the running application. Searched for 30 seconds."

This article includes steps that you can take to correct the search criteria that QA Wizard Pro uses to locate the control at playback.

[edit] Solution

QA Wizard Pro uses a dynamic search system to attempt to locate controls in the application that it should interact with. During recording, QA Wizard Pro records many properties about the control, and creates an object in the application repository which represents that control. The object has a default set of search criteria, which is configured based on the type of object. The default search criteria works in the majority of cases. However, there are instances when the default search criteria is not the best criteria to find a control in a specific application.

For example, the default criteria for locating text input boxes in HTML includes the "Tag Id" (which corresponds to the HTML id attribute), Name, and, if there is more than one text input box on the page, a vertical repeat index.

With dynamically generated Web applications, sometimes one or more of these criteria change every time the page is loaded. For example, the name or id might be dynamically generated (or a portion of it might be dynamic, such as name="itemQuant_12345", where 12345 is a dynamic number).

In these situations, to enable QA Wizard Pro to successfully locate the object every time the script plays back, you need to analyze the problem and select different search criteria.

The first step in this process is to locate the correct control in the QA Wizard Pro application repository. After you locate the control, right-click it and select 'Properties' from the context menu. This opens the control properties dialog box, which looks similar to the following screenshot:

Image:QAWP Control Properties.jpg


Notice the check boxes down the left side of the dialog. Any property that is selected, or checked, is used as a search criteria. To successfully complete the search, the control must match ALL selected properties. That is, the search criteria are logically joined by an AND operator. So, the first question to ask is, can QA Wizard Pro reliably find the control using a different set of criteria? If so, simply clear or select criteria as appropriate.

If you decide that one of the criteria, such as name, is a good search criteria, but has a portion that changes, you can use regular expressions to search for a pattern match. For example, in the itemQuant_12345 example, you can use a regular expression to search for the dynamic portion.

To use a regular expression, click in the Expected Value field of the property you want to set up the regex search for. The field changes to an editable text box. Type '@@' at the beginning of the field (this tells QA Wizard Pro it is a regular expression and not a literal value) followed by the regular expression. For example:

@@itemQuant_.*

QA Wizard Pro uses .NET regular expressions. The syntax of regular expressions is not something I can cover here (it's quite powerful, but also quite complex). If you perform a Web search for ".NET regular expressions", you should be able to find many pages of information about the regular expression syntax. Or, you can refer to a book on .NET programming to see if it has a regular expressions section.

One final note - sometimes this error message is triggered because QA Wizard Pro cannot locate the correct window/page that contains the control. This is particularly common if the window title changed from when you recorded the script to when you play it back (for example, in certain scripting scenarios, the title bar may change every time you run the script). So, if the search criteria for the control looks correct, you may need to check the search criteria for the window/Web page that is the parent of the control, to see if you need to re-configure the search for that.














Issue Management Software | Source Code Control Software | Test Case Management | Requirements Management Software