Forum Discussion

aldebaran's avatar
Occasional Contributor
13 years ago

Waiting for control

Hi all,

I sometimes get exceptions in script-routines when the real object behind a mapped object is passed as a parameter from a keyword test.

This only happens sometimes, because the object, in this case a .net DataGridView, is not completly finished loading with all it´s columns and rows. In the script it seems as if the projects "auto wait time" has no effect for a gridView´s Column or Row properties ?!

The exception message: Dieser Vorgang wurde wegen Zeitüberschreitung zurückgegeben
Unit: "SetVariables" Line: 8 Column: 6.

I guess in English it woud translate to: "The procedure was terminated due to a timeout Unit: ...."

The script-routine in question works perfect and is used from plenty of other keyword-tests.


Sub setGridLastRowIndex( GridObj )

     Project.Variables.LastGridRowIndex = GridObj.Rows.Count -1

     Log.Message("LastGridRowIndex is: " & Project.Variables.LastGridRowIndex)

End Sub

auto wait time is high: 30000 milliseconds

I would like to avoid inserting any extra teststeps or calls to yet another script from the keyword tests that use 'setGridLastRowIndex'

What´s the dos and donts if one wants to avoid absolute waits?

Any suggestions are appreciated.



1 Reply

  • tristaanogre's avatar
    Esteemed Contributor
    The best way to do this without using hardcoded "Delay" calls is to use a WaitProperty method on the object.  The Object may be loaded but, as you pointed out, the property is not fully resolved yet.  So something like

    MyObject.WaitProperty("RowCount", "10", 10000)

    Will wait for the RowCountProperty of MyObject to equal the number 10 for a maximum of 10 seconds.  If the property resolves before those 10 seconds, the method returns as TRUE.  If it takes longer than the 10 seconds, then the method returns as FALSE.  You can wrap an If/Then around that then to say "If not WaitProperty Then Log Error" or whatever you need to have happen.

    There is a whole set of topics in the help for this particular kind of scenario at

    For the WaitProperty method specifically, check out