I am fed up of using wait function in the script considering the way the developers coded and as a tester I want to wait for the object to be displayed.
So I was just wondering if someone can help me in providing a generic function where I want to pass the object name and the system would wait for the object to be loaded.
Thanks in advance.
What you can do is check if object exists, if true continue threw the script, if not do something else (exitaction, exitglobal iteration) etc
Patience is like bread I say.... I ran out of that yesterday.
you can use a while loop with timer. If object found then exits else exit on assigned timer.
<font class="small">Code:</font><hr /><pre>
intObjectExist = fObjectExist(oObject, 60) 'waits max 60 sec
Function fObjectExist(oObject, iTimer)
fObjectExist = True 'Sets to true
Do While Not oObject.Exist(0)
Wait 1 'Wait for a sec
x = x + 1
If x > iTimer Then
fObjectExist = False
Why would you do that?
.Exist already has a timeout built in. .Exist(60)
U can use the loop and exist to check for the same!!
Winds of Change
Why in the world would you use a loop?
The Exist method has a built-in timeout loop by specifying the time to wait .Exist(60)
You are duplicating and complicating code if you write a loop.
I wish to loop until atleast the object was visible may b using something like
while not ..... .Exist
Why don't you use WaitProperty?
I follow below type of code extensively in my scripts to avoid the hard coded wait statement.
If Browser().Page().WebEdit().Link().WaitProperty(Pro pertyName, PropertyValue, [TimeOut]) Then
i have never seen bugs sleeping
Waitproperty does not check for existence, only a property change. You are just using the default object sync in that case.
So on what property u wish to check for existence