Nigel Thorne
Nigel Thorne

Reputation: 21558

Test Complete/Execute 8 won't RefreshMappingInfo unless it's done through COM

I am running a test script in TestComplete v8. The object graph in memory gets out of date (as a dialog has appeared).

I run the following VBScript code

Sys.Process("iexplore").RefreshMappingInfo()

And I get the following error message...

Unable to find the object RefreshMappingInfo. See Additional Information for details.

The object with the specified attributes does not exist.

Possible causes of the error

This error relates to TC interpreting the method call as an attempt to find a control.

What is really odd.. If I connect to TC8 via COM and execute the same code, it works fine. So in ruby:

require 'win32ole'
tc = WIN32OLE.connect("TestComplete.TestCompleteApplication.8")
integration = tc.integration
Sys = integration.GetObjectByName("Sys")
puts Sys.Process("iexplore").Page("http://localhost:50563/x.aspx") _
  .Form("form1").Panel("silverlightControlHost").Object(0).UIAObject("Popup").Exists
' This returns false

Sys.Process("iexplore").RefreshMappingInfo()
' No error raised

puts Sys.Process("iexplore").Page("http://localhost:50563/x.aspx") _
  .Form("form1").Panel("silverlightControlHost").Object(0).UIAObject("Popup").Exists
' returns true

Why doesn't this work during a test? How do I fix it?

Upvotes: 0

Views: 769

Answers (1)

Dmitry Nikolaev
Dmitry Nikolaev

Reputation: 3918

TestComplete has three object trees:

  1. The Sys tree which can be found in the Object Browser panel and contains all application objects.
  2. The NameMapping tree which contains all the mapping names.
  3. The Aliases tree which is used when tests are recorded and which can be flexibly modified by a tester.

Objects in the Aliases tree reference objects in the NameMapping tree and objects in the later are referencing objects in the Sys tree. The RefreshMappingInfo method is used to refresh these references stored in objects of the NameMapping tree to objects in the Sys tree. So, the method exists only for objects from the NameMapping and Aliases trees.

In your code, you work with an object in the Sys tree: Sys.Process("iexplore"). You get an error since objects from the Sys tree does not have the RefreshMappingInfo method. You need either call the Refresh method or try working with an object from the NameMapping or Aliases tree. For example:

  • Sys.Process("iexplore").Refresh()
  • Aliases.IExplore.RefreshMappingInfo()

Upvotes: 1

Related Questions