Avoiding the “Unable to Find Object” Error in TestComplete

Automated testing is a great way to save time and increase test efficiency but nothing is perfect, unfortunately. Automated test performance is directly affected by how hardware, objects and the code in which we are testing react to the tests and other processes running in parallel. Test environment set up and test maintenance is crucial in the test automation process, because improper set up and maintenance can cause performance issues causing tests to fail before they even have a chance to detect defects.

Here are some reasons an automated test could be interrupted:

  • Hardware error or failure
  • Software hang or crash
  • Object timeout

One of the most common performance issues seen in TestComplete is the “Unable to find object” error. Nothing is worse than having your automated tests come to a screeching halt because they were interrupted. However, the issue here isn’t the automated tests themselves, but object load times causing timeouts during a test. Sometimes automated tests will quickly select an object that hasn’t had time to load, for instance, selecting an object before the window in which the object to be tested is embedded has finished opening. There should be a set amount of time to allow an object to load, since TestComplete can run tests at a faster pace than some objects can load. By default, TestComplete will wait 10 seconds for an object to load, if it happens to take longer the test will fail and you will get a test error “Process not found.”

There are a few ways in which you can change the timeout. You can change the default Auto-Wait timeout for TestComplete or by adding a timeout to the test script or a keyword test.

To change the Auto-Wait timeout (default) for TestComplete:

1. Double click on the project name in the Project Explorer.

project-explorer-testcomplete2. Click on Properties.

properties-testcomplete

3. Select Playback.

playback-testcomplete

 

4. Change the Auto-wait timeout to a preferred amount of time and make sure Stop on error option is checked.

auto-wait-timeout-testcomplete

You also can set timeouts for individual operations in TestComplete. This may be the preferred method if it is only an individual object giving you trouble. This is done by using a timeout parameter.

5. Right click on the grid header and select Field Chooser.

grid-header-testcomplete6. Drag the Auto-wait timeout command to the grid header.

auto-wait-timeout-testcomplete-27. Specify the amount of time (ms) to wait before the next operation.

specify-ms-testcomplete

If you ever have any issues with TestComplete, the SmartBear community forums are a great place to find the answer you may be looking for.

We always love to hear your feedback, so feel free to drop a line below and let us know how we’re doing. Our support team is ready to assist and you can always check out our FAQs if you need to find an answer quickly.

 See also:


Close

By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox