Anyone ever run into something like this:
I've got a script that's been running for months. I've been working on updating it to recover from unexpected errors from the application it's testing.
Because of that, I'm using a lot more win_get_text/index statements embedded in loops to check the screen for different output before continuing.
This method works fine in the first part of the script, but started failing towards the end of the script. I captured the output of the win_get_text statement when it failed and noticed that it wasn't returning all of the text from the application screen.
I know I can limit the area that win_get_text captures from the screen, but the area I need to grab can change, so I'd like to keep to reusing the same code and grab the entire window.
I suspect that after so many win_get_text statements, WinRunner is having a problem releasing space from wherever it stored the previous win_get_text grab (memory? buffer?) and so it can't grab the full screen one the one that's failing.
This is WR 7.01. For several reasons within our env, upgrading isn't an option. The application is a green screen/terminal app running on VMS. I connect through PowerTerm from Windows NT.
I've used this method to capture application output for a long time without issues and it does still work with this exception. I haven't counted the characters when this comes up, but it does seem to work on other screens that have a lot more characters. An example of the code is:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">
vCheckLoop = 1;
while(vCheckLoop <= 30)
vLoginText=index(vWinText,"Some text to look for"
if(vLoginText != 0) break;
vCheckLoop = vCheckLoop + 1;
}</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">I'm open to ideas or better ways of doing this, and all replies are appreciated.
Re: win_get_text problem
Based on the loop only - I would say you need to increase your wait time, although I tend to not use wait statements.
You might add a win_activate and/or set_window statement just prior to your win_get_text statement. That should help and force some level of synchronization - which appears to be the issue.
Re: win_get_text problem
Your first suggestion did the trick.
I use set_window throughout the script, but for short loops like this where I'm only checking for text in a single screen, I generally have set_window just before the loop.
I moved it into the loop and everything appears to work fine.
Thanks for the suggestions.