When I submit data on one of our webpages the word 'loading' is displayed on the page. What I want to do is create some sort of looping mechanism that will check this page for this text every second while 'loading' is displayed and to break when the text is no longer shown. I can use GetText() but how to loop this. Sometimes this text is displayed for 5 seconds and other times it is displayed for 40 plus seconds (depends how much data is to be submitted). Therefore, I need to be able to handle this. Thanks for any help offered.
<font class="small">Code:</font><hr /><pre>
[-] for (i = 1; i <= MAX_WAIT_TIME; i++)
[-] if (SomeItem.GetText() == "Loading...")
[ ] sleep(1)
[ ] break
where MAX_WAIT_TIME is a variable you define in seconds to wait so you don't get into an infinite loop. It's then up to you to decide if it timed out or not.
Have you tried looking into "Browser.WaitForReady()" function that Silk has built in? This function takes a parameter - time (in seconds) to wait before raising an appliction not ready exception.
Not sure what you are trying to monitor while the page is loading. In case you want to check for how long the page took, you can initialize a Timer and start it right before submitting the data and end the timer as soon as the browser completes loading.