cancel
Showing results for 
Search instead for 
Did you mean: 

WaitChild method, syntax and how does it work?

Highlighted
New Contributor

WaitChild method, syntax and how does it work?

I have an application that pops up a dialog with an unpredictable number of lines of text. 



The application expects the user to read each line of text -- and does so by making sure the user hits the down-arrow for every text entry.

When the lines of text are exhausted, a button is displayed at the bottom of the dialog -- the user needs to select that button to continue.



My plan was to use code like:





     while not Aliases.TMDS.frmSingleFormAuthorityCP.gbTNT.btnRepeatTNT.WaitChild("btnRepeatTNT", 1000).Exists

        Call Aliases.TMDS.FrmSingleFormAuthorityCP.gbTNT.Keys("[Down]")

     wend

     Call Aliases.TMDS.frmSingleFormAuthorityCP.gbTNT.btnRepeatTNT.ClickButton



However, when executing the script, the button pops up, but I never exit the while/wend loop -- it just keeps on down-arrowing ad-infinitum.



The "btnRepeatTNT" object is a child of the .gbTNT. object.





What am I doing wrong?


4 REPLIES 4
Highlighted
Contributor

RE: WaitChild method, syntax and how does it work?

I think your problem is not re-evaluating the object after the key press down.



What happens is that when you evaluate the expression [Aliases.TMDS.frmSingleFormAuthorityCP.gbTNT.btnRepeatTNT.WaitChild("btnRepeatTNT", 1000).Exists ] TC returns a stub object (similar to other wait methods, see for example WaitWindow)with Exists = False

After that, the object never gets refreshed to check if now the object does in fact exist



I would add a line this way:

while not Aliases.TMDS.frmSingleFormAuthorityCP.gbTNT.btnRepeatTNT.WaitChild("btnRepeatTNT", 1000).Exists

        Call Aliases.TMDS.FrmSingleFormAuthorityCP.gbTNT.Keys("[Down]")

        Call Aliases.TMDS.frmSingleFormAuthorityCP.gbTNT.btnRepeatTNT.WaitChild("btnRepeatTNT", 1000)

wend

Call Aliases.TMDS.frmSingleFormAuthorityCP.gbTNT.btnRepeatTNT.ClickButton



Help this helps.
Highlighted
Staff

RE: WaitChild method, syntax and how does it work?

Hi,



Actually, WaitChild won't work with mapped objects. You need to use the WaitAliasChild method:



Set obj = Aliases.TMDS.frmSingleFormAuthorityCP.gbTNT



While not obj.WaitAliasChild("btnRepeatTNT", 1000).Exists

Call obj.Keys("[Down]")

Wend



Call obj.btnRepeatTNT.ClickButton


------
Yuri
TestComplete Customer Care Engineer

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Contributor

RE: WaitChild method, syntax and how does it work?

my bad 🙂
Highlighted
New Contributor

RE: WaitChild method, syntax and how does it work?

The WaitAliasChild worked.  Thanks.
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors