Forum Discussion

allenj2020's avatar
allenj2020
Contributor
5 years ago

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 but...
  • tristaanogre's avatar
    tristaanogre
    5 years ago

    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

     

    https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/findchildex-method.html

     

    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.