Let's say I pass the Browser("MyBrowser").Page("MyPage").WebCheckBox("MyBox") functions:
MyFunction (Browser("MyBrowser").Page("MyPage").WebCheckBox("MyBox"))
Later, the function wants to record the logical name of the received test object (which in this case, of course, is "MyBox").
How can I do that?
The test object's name property returns the name that is created if you re-add the test object. There is no (documented) property of a test object for a logical name. The properties of the runtime object cannot contain a name because it is not a name from the AUT GUI.
So, I think the test object does not know its name. Only the repository "knows" under what name the test object is stored.
Therefore, I will need to inspect the repository itself, and not the test object.
The ObjectRepositoryUtil API allows me (via GetChildren or other methods) to find a test object in the collection of test repository objects and use the GetLogicalName method to get my name. Good.
But the only way to make it work is to get a link to the repository by downloading it. I get the impression that this API is designed to manipulate (or analyze) repositories outside of QTP, and not from a test run. I do not want to reload the repository. I want to see a test object in one of the already downloaded repositories.
The RepositoriesCollection API can tell me which ones are loaded (by their name and path), but it does not provide a means to get a reference to an instance of an object that represents one of these repositories.
So, how can I get a link to an already downloaded repository, so I can use GetLogicalName ?
Or, as a rule, the task: given the link to the "normal" test object contained in the general repository of the current action, how can I find out its logical name programmatically?
If there is some superintelligent QTP master, and la Motti, who knows that this cannot be done, I really appreciate the answer from him, even if he reads “this is impossible”, if it is true.