Forum Discussion

adam81's avatar
adam81
New Contributor
5 years ago
Solved

Setting an object takes too long

Hi,

i'm new to test complete. I'm trying to understand how does the Set method works. though my auto-wait timeout is set to 10 secs , i see sometimes it takes over 20 secs to set an object. Not sure what i'm doing wrong, please see my below example. My Code do identify the object , the question is why does it take long in " Set myObj = pObj.FindChild(Array("ObjectType","ObjectIdentifier"),Array(objType,objIdent),30)  "  ,, it doesn't take that long in all object, only some page objects. Thanks

'Calling the Function 

Sub Test()

Set myPage = MyPage

If MyPage. Exists Then 

     Log .Message "page Found"

     Set obj =   FindObj(myPage ,"Textbox","ctl00_ContentPlaceHolder")

          if obj.Exists Then

             obj.SetText("Test")

          Else

             Log.Error "Object Not Found"

          End If

End If

End Sbu

Function FindObj(pObj,objType,oIdent)

Set myObj = pObj.FindChild(Array("ObjectType","ObjectIdentifier"),Array(objType,objIdent),30)

if myObj .Exists Then

Set FindObj= myObj 

Else

FindObj = Nothing

Set 

 

End Function

  • Well, here's the thing... while the timeout setting can be adjusted, it's not something you necessarily WANT to make too short.  It's a timeout, meaning that it will return earlier than the max setting once the object is found.  So, you want it to be sufficiently long to be able to find the object.  This is not a "problem" in the automation, it's a part of automation: detecting when objects become available.

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    My guess is that the object that you have designated as pObj isn't found yet.  It may not be fully loaded, rendered, etc., so the 20 seconds is the built in timeout.  Additionally, the FindChild method uses the default timer as set on the project so the child object may not be found yet either.  

    • adam81's avatar
      adam81
      New Contributor

      Thank you, is there anything i can do from my end to reduce the time ? there are only certain objects that are doing it,,, not all the objects on the page. You mentioned 20 secs is the built in timeout, is it modifiable?

      thanks

      Adam

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Well, here's the thing... while the timeout setting can be adjusted, it's not something you necessarily WANT to make too short.  It's a timeout, meaning that it will return earlier than the max setting once the object is found.  So, you want it to be sufficiently long to be able to find the object.  This is not a "problem" in the automation, it's a part of automation: detecting when objects become available.