Forum Discussion
david_vickers :
Hi,
To rephrase what was written by BenoitB :
By definition, checkpoint is an action that performs some validation. In your scenario you are not validating, but waiting for some object/image to appear. Thus you should not use checkpoint but need to wait (via one of the .WaitXXX() methods) or wait in a loop until the sought for object/image appears or timeout occurs.
- david_vickers5 years agoOccasional Contributor
Thanks AlexKaras,
Is there a sample that you could point me to on how to implement a loop check? I would be using it multiple times within my test script as I navigate screens, so hopefully I can use it in a function/subroutine.
Hi,
Exact implementation might depend on your needs and tested application.
> there's a brief loading screen that displays before the login prompt
For example, one project had this code to wait until the spinner object disappears:
// wait until spinner is hidden and control is populated with data oSpinner = oCombo.Parent.FindChild( ["ClrClassName", "WPFControlOrdinalNo"], ["ProgressIndicator", oCombo.WPFControlOrdinalNo], 3); iStartTime = Win32API.GetTickCount(); iStopTime = iStartTime + timeout; while(((oSpinner.Visible) || (0 == oCombo.wItemCount)) && (iStopTime >= Win32API.GetTickCount())) aqUtils.Delay(500); if(Win32API.GetTickCount() > iStopTime) Log.Warning( aqString.Format("Control was not populated with data within %i sec timeout", aqConvert.VarToInt(timeout / 1000)), aqString.Format("Target combo-box: %s", oCombo.FullName), BuiltIn.pmNormal, null, Aliases.<tested app window>.Picture()); ...
Hope, you got the idea.
Two questions and one remark if you don't mind on your sample :
- Good idea to use getTickCount, it's not using a Timer object like StopWatch (HISUtils) so ligther on the system, ;^)
- Why checking Visible and not VisibleOnScreen ? I've lot of projects where spinner or toaster are Visible because preloaded on page but not VisibleOnScreen till they need for.
- Why checking count of items of the combo, so here if items = 0 it's not the combo not available but the data of the combo which aren't available (data vs ihm) ?