aqObject.GetPropertyValue object does not exist after an exist check passes
Hi all,
New one that suddenly started and intermittently pops up.
Code:
var loadingPanelObj = Aliases.browser.FindChildEx(["ObjectType","ObjectIdentifier"],["Table","ASPxLoadingPanelMain"],3,true,10000); if(loadingPanelObj.Exists && aqObject.IsSupported(loadingPanelObj,"VisibleOnScreen")) { //So, Loading Panel exists, but the following line of code errors
var isVisible = aqObject.GetPropertyValue(loadingPanelObj,"VisibleOnScreen");
// The error: The Object "Table("ASPcLoadingPanelMain")" does not exist }
Any thoughts about this ? At this point in the KWT I would expect the object to be on the page, so that's as expected. In theory if the .Exists is true, the next step shouldn't say it doesn't exist ? If it helps, it seems there may be a pattern that this only appears to happen in the places where this script is the first thing called after a postback, but without navigating to a new URL e.g. clicking the save button and waiting for a redirect to itself
Hi,
> In theory if the .Exists is true, the next step shouldn't say it doesn't exist ?
Correct. But only in case if the object was not recreated (or just destroyed).
Note, that you are using Aliases to reference test objects and this is fine. But Aliases functionality has some specific that it caches objects once found and tries to reuse them later. And if the object is recreated, the problem will occur. See https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/refreshmappinginfo-method.html for some more description.
My guess is like yours: the target table might be recreated by script code on the page and this invalidates its previously found (and cached) instance. If this is the case, then you need to figure out the way (or ask developers to implement some flag for you) to identify if test code must wait for the table to be recreated.
P.S.
Out of curiosity: why instead of
var isVisible = aqObject.GetPropertyValue(loadingPanelObj,"VisibleOnScreen");
not to use just
var isVisible = loadingPanelObj.VisibleOnScreen;
?