Why does my automated test fail to locate a web element on the page?

Occasionally, you may encounter an error during automated playback on a web browser indicating that a given control could not be found.

Locating web elements, or controls through TA properties

Typically, a UI element is located on a web page by means of one or more TA property-value pairs. Some of the TA properties most commonly used for identification are:

Debugging during playback

Generally, the most productive way to diagnose and remedy an unmatched control due to a failed TA property is during automated playback, when you have the AUT running and the test procedure halts at the point of failure.

Below is a typical error message that TestArchitect displays when a web element is not found.

  1. Why is your test unable to locate the desired web control?

    Before you decide that your problem can be solved by switching to a different TA property, it is important to understand the reason your test failed to find the control. In some cases, the issue is not from the TA property itself, so changing to a different one won’t help.

    Here are some common causes:

    • Wrong specified set of interface definitions, also known as an interface:
    • Element attributes changed:
      • Web pages are often generated dynamically. The more sophisticated the AUT, the more likely this becomes. As a result, certain parts of the page will be different each time the page is visited, or when it is visited with different user credentials. When your test needs to locate dynamic controls, the best option is to use expression-based dynamic identifiers. (Learn more.)
    • Element does not yet exist, or the automated test proceeds too fast for the AUT, testing for the element before the application can render it:
      • Complex web pages may take a few seconds to load, and web page scripts may also need time to load additional content after that. Thus, web page load times may vary. Which means that sometimes a given web element cannot be found simply because it has not appeared. Successful testing requires that the automation correctly handle the varying response times of the application. One option – a bad one, for reasons that should be obvious – is to allow your test to wait indefinitely. A much better approach would be to specify a maximum wait time, which you do with the object wait or object wait probe built-in settings. (For further information regarding how to handle timing issues, refer to Timing.)
  2. Choose a new TA property:

    If you’re sure that your problem can be rectified by using a different TA property (or, perhaps, an additional TA property), examine the control in the page to see what other TA properties it has to offer to identify it. The Interface Viewer and/or Identify tools are your best bets. These tools display all the available TA properties that can be alternatively used to locate the control.


Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGearはLogiGear Corporationの登録商標であり、Action Based TestingおよびTestArchitectはLogiGear Corporationの商標です。ここに記載されているその他の商標は、各所有者の財産です。

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400