Forum Discussion
Hi,
If I got your question and problem right...
.FindChild() should work for you and it looks like you are using it correctly: call for .FindChild() and then check .Exists for the search result.
It is something else that makes me doubting:
> same name and location in the structure if it is on the page (browser->form->panel->LoadPanel Table)
I guess (as I don't know the exact implementation in the tested application) that despite the fact that the location and the name of the loading panel is the same, it is created and recreated by some page script when the page and/or page's data is reloaded. If the above guess is correct, then you should not keep the reference for the loading panel object in the variable, but must get the reference a-new every time. (Performance penalty should be minimal as the search is done by the sought for object's name.) Especially, considering the fact that you are using Aliases as the search root.
The reason for above is that the stored reference to the object uses explicit path to it (e.g. Aliases.browser.Form.Panel.LoadingPanelTable) and if the LoadingPanelTable object is recreated during page/data reload, then the stored referenced object is invalidated and thus TestComplete fails to find the old LoadingPanelTable object even if the new created one has the same name and position in the objects tree.
https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/how-to/refresh-cache.html might provide additional useful info.
- RUDOLF_BOTHMA7 years agoCommunity Hero
.FindChild() should work for you and it looks like you are using it correctly: call for .FindChild() and then check .Exists for the search result.
In theory, yes, but I'm getting an object does not exist error if it's not on the page at all
The reason for above is that the stored reference to the object uses explicit path to it (e.g. Aliases.browser.Form.Panel.LoadingPanelTable) and if the LoadingPanelTable object is recreated during page/data reload, then the stored referenced object is invalidated and thus TestComplete fails to find the old LoadingPanelTable object even if the new created one has the same name and position in the objects tree.;
Valid point. It's been working fine so far, but I should probably change it
- AlexKaras7 years agoChampion Level 3
I'm getting an object does not exist error if it's not on the page at all
Can you provide a relevant line of code and exact error message from test log, including the text from the Additional Info pane?
- RUDOLF_BOTHMA7 years agoCommunity Hero
My apologies. That was old data - I was having the issue on Friday before a minor code change last thing in the day that fixed it and I forgot about it over the weekend doh ! :smileysad:. Today I have it working, but I'm still hoping to find a way of making it a bit more efficient. My Run Timeout is currently 30 seconds (yes, some controls on my site actually take that long), so this function could take 30 seconds plus change before it continues. On a page with just 4 controls, that could add 2 minutes. I am using a FindChildEx though - that cuts it down. I could do:
var currentTimeout = Options.Run.Timeout; Options.Run.Timeout = 100; // find table, wait etc. Options.Run.Timeout = currentTimeout
But that opens the window again for the table actually being there, but the timeout being too short for TC to track it down because the page loads a bit slow. I'm not saying there's a better solution than the current one I have. It would just be nice to ask TC to just tell me if it's on the page as quick as possible rather than try and find it for a long time that I make up and tweak every time the test doesn't find the table even though it's there all because I made the delay too short.
Related Content
- 10 months ago
- 4 months ago
Recent Discussions
- 3 days ago
- 3 days ago
- 6 days ago