FindChild for newly created page objects
Hello all,
I'm a long time TestComplete desktop user, just getting used to the web object handling.
What I'm trying to figure out is how to consistently handle a situation where I click on a button on a page, and it causes a popup dialog (new page), that I want to perform operations on.
That page has objectIdentifiers, so I can use FindChild to find and operate on them, which is good because the object path can be quite deep. But, they may not be rendered yet so FindChild doesn't find the object.
What's the best way to do a dynamic wait to see if the new page is fully loaded before I search for an object in it?
I am not using NameMapping.
I tried this syntax, but it doesn't work consistently, the first WaitPanel often returns before I can find the child.
Sys.Browser("chrome").Page("*").WaitPanel(1, 5000); // This returns immediately without waiting
Sys.Browser("chrome").Page("*").FindChild("contentText", "Available Locations*");
Thanks.
Allen
Well, you're calling "WaitPanel" from the page object. So, it's waiting for the immediate Panel(1) right off the page object. This is why it's returning immediately because I'm assuming that there is already a Panel(1) on the main page that you didn't need to wait for.
FindChild, as you're using it, doesn't have a Timeout/Wait built into it. To do that, you should use FindChildEx
This will search for the child but note that you will need to specify a depth to search. Again, as you have it set, it's only searching the immediate child of the page so that's why it's not working well.
Side note: Some of this WOULD be a bit simpler if you utilized Aliases of mapped objects. You could map the desired panel, make it a direct Alias child of the page, and then use page.WaitAliasChild("childName", 5000) to wait for the object.