Wait property in Silk
Printed From: One Stop Testing
Category: Testing Tools @ OneStopTesting
Forum Name: SilkTest @ OneStopTesting
Forum Discription: SilkTest is an automation tool for testing the functionality of enterprise applications in most versions of Windows, Sun Solaris 9 & 10, and Red Hat Enterprise Linux WS 2.1 & 3.0.
URL: http://forum.onestoptesting.com/forum_posts.asp?TID=878
Printed Date: 17Nov2024 at 9:49am
Topic: Wait property in Silk
Posted By: ritu
Subject: Wait property in Silk
Date Posted: 24Apr2007 at 9:45pm
How to use the wait method in Silk test? iam suppose to test a web page
but it so happens like silk test doesn't wait for the page to be
loaded, so how to overcome this problem?
|
Replies:
Posted By: suvam
Date Posted: 25Apr2007 at 1:58am
You might also want to build your own function as there are times when SilkTest thinks the
page is done loading and it isn't really.
Code:
[+] BOOLEAN WaitFor (WINDOW wObject, REAL rTimeout optional)
[ ] BOOLEAN bRtn
[ ] HANDLE hTimer
[ ]
[ ] // if the timeout interval hasn't been specified
[+] if (rTimeout == NULL)
[ ]
[ ] // set it to whatever the agent value is
[ ] rTimeout = Agent.GetOption (OPT_WINDOW_TIMEOUT)
[ ]
[ ] // create a timer
[ ] hTimer = TimerCreate ()
[ ]
[ ] // start the timer
[ ] TimerStart (hTimer)
[ ]
[ ] // so long as the object isn't here
[+] while (wObject.Exists () == FALSE)
[ ]
[ ] // if we've exceeded the timeout value
[+] if (TimerValue (hTimer) > rTimeout)
[ ]
[ ] // break out of the loop
[ ] break
[ ]
[ ]
[ ]
[ ] // nuke the timer
[ ] TimerStop (hTimer)
[ ] TimerDestroy (hTimer)
[ ]
[ ] // if the object STILL doesn't exist
[+] if (wObject.Exists () == FALSE)
[ ]
[ ] // set the return value to false (in case they're trapping)
[ ] bRtn = FALSE
[ ]
[ ] // // raise an error (can be trapped with a do...except back in the calling
function/method
[ ] // raise 1, "*** Error: Timed out waiting for {wObject}"
[ ]
[+] else
[ ] bRtn = TRUE
[ ]
[ ]
[ ]
[ ] // and we're outa here
[ ] return bRtn
|
|