Ask a Question

Setting an object takes too long

SOLVED
adam81
New Contributor

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

3 REPLIES 3
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.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

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
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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: