Forum Discussion

rajesh_makiredd's avatar
rajesh_makiredd
Occasional Contributor
11 years ago

how to pause/wait until the object found.

Hi,



    My object(Project.Variables.Var = w.Item("lblMsg").outerText) is to find the outertext. Some times it takes more time to get the outertext value, so how to pause/wait untill the outer text is find. I have already tried with the different properties like wait,WaitProperty, But not working.  Please suggest me..

  • Hi,



    You can use "FindChild" on the objects parent with "outerText" as one of the properties.

    Put the code in a while as long as possible. say 10 min for ex.



    thank you. Ashok


  • I don't know what language you're using. So, using pseudo-language, I do something like this:



    I Pass in ....



    WaitTime = x

    MaxNumberOfAttempts = y

    ObjectToFind = <OBJECT>



    Function WaitForObject(WaitTime, MaxNumberOfAttempts, ObjectToFind)



    Attempts = 0

    StartTime = Timer



    Do



      check = Does ObjectToFind Exist ?

      

      If check is FALSE Then

          Attempts = Attempts + 1

      End If



    Loop Until (check is TRUE) or (Attempts = MaxNumberOfAttempts) or (Timer-StartTime > WaitTime)



    Determine which condition was met and update return info.



    End Function





    Pass in the object you want to wait for, how many attempts it is allowed, and how long you are prepared to wait. The function does the rest and passes back a true or a false (or more info if you want) depending on the condition that caused it to exit the loop.