Update Selectors for Web Objects

Applies to TestComplete 14.93, last modified on October 12, 2021

To simulate user actions over elements in a web application or on a web page, TestComplete locates the elements by using XPath expressions and CSS selectors. It stores these expressions and selectors in the Name Mapping repository of your TestComplete project.

If your tested application or web page has been modified or updated (for example, if a new version has been released), its elements may change their position in the DOM hierarchy, or their ID, class, or caption can change. The stored selectors will no longer remain valid and TestComplete will not be able to identify the web elements on the page correctly.

You can update the selectors to match the actual state of the object:

Prerequisites

  • Launch one of the supported web browsers and navigate to the tested web application or a web page.

  • Make sure that the object whose selectors you want to update is present on the web page.

From the Name Mapping repository

  1. Open the Name Mapping repository of your project in TestComplete.

  2. Locate the object whose selectors you want to update.

  3. Click Update Selectors on the repository toolbar or right-click the object in the Mapped Objects tree and then click Update selectors.

  1. TestComplete will open the Update Selectors from Object dialog.

  2. Using the or tools that the dialog provides, point to the target object in the web browser.

  3. Click OK. TestComplete will generate selectors for the object you have pointed to and replace the stored selectors with the new ones.

Updating selectors from the Name Mapping editor

Click the image to enlarge it.

From the test log

If a web object’s selectors are no longer valid, TestComplete will not be able to find the object during the test run and report the “The object does not exist” error:

  1. Select the error message in the test log.

  2. Explore the Picture panel and the Details panel. Make sure that the problematic web object existed during the test run.

  3. Click the Update the search criteria link in the Details panel

  1. TestComplete will open the Update Selectors from Object dialog.

  2. Using the or tools that the dialog provides, point to the target object in the web browser.

  3. Click OK. TestComplete will generate selectors for the object you have pointed to and replace the stored selectors with the new ones.

Updating selectors from the test log

Click the image to enlarge it.

See Also

Update Name Mapping
About Cross-Platform Web Tests
Handling the 'Object Does Not Exist' Error

Highlight search results