WinRunner: How to access the last window brought up?

WinRunner: How to access the last window brought up?

Rc = win_get_info(\"{class: window, active: 1}\", property, result);Is there something or some script that can determine the LAST WINDOW DISPLAYED or OPENED on the desktop and in order to use that information to gather the label.there are a couple of solutions, depending on what we know about the window.

 If we know distinguishing characteristics of the window, use them and just directly describe the gui attributes. I assume that we do not have these, or we would likely have already done so.If not, there is a brute force method. Iterate over all of the open windows prior to the new window opening and grab their handles. 

After our new window opens, iterate again. The \'extra\' handle points to our new window. We can use it in the gui description directly to manipulate the new window. As I said, a bit brutish, but it works. We can use the same technique when we have multiple windows with essentially the same descriptors and need to iterate over them in the order in which they appeared.Any object (or window) can be described by it\'s class and it\'s iterator. if I wanted to address each of the individuals in a room and had no idea what their names were, but would like to do so in a consistent way would it not be sufficient to say - \'person who came into the room first\', \'person who came into the room second\', or alternately \'person who is nearest the front on the left\', \'person who is second nearest the front on the left\'. 

These are perfectly good ways of describing the individuals because we do two things : limit the elements we want to describe (people) and then give an unambiguous way of enumerating them.So, to apply this to our issue : we want to do an \'exist\' on a dynamically described element (window, in your case). So we make a loop and ask \'window # 0, do you exist\', if the answer is yes, we ask for the handle, store it and repeat the loop.Eventually we get to window n, We ask if it exists, the answer is no and we now have a list of all of the handles of all of the existing windows. We should note that there will be n windows ( 0 to n-1, makes a count of n).We may need to brush up on programmatically describing an object (or window), the syntax is a little lengthy but extremely useful once we get the feel for it. It really frees we from only accessing objects that are already described in the gui map. 

Try this as a starting point, we\'ll need to add storing & sorting the handles themself :i = 0;finished = FALSE;while (finished == FALSE){if (win_exists(\"{class: window, location: \"\" & i & \"\"}\"\") == E_OK ){win_get_info(\"{class: window, location: \"\" & i & \"\"}\"\", \"handle\", handle);printf(\" handle was \" & handle);i ++;}else{finished = TRUE;}}


By:UMANG
Date:2002-02-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related TESTING Subjective Links

TESTING Subjective interview questions and answers for experienced and fresher