10-Dec-2006 - Analogue recording - WinRunner
We all had to use analogue recording once. The problem for us all is when the object changes its position. If we use this kind of recording isn't because we want but because we have no other option. This might happen when our objects aren't recognised, even if we load the appropriate add-in.
The parent window is normally recognised, if I move it, the unrecognised object might not be used.
One way to solve this problem is using a method that moves the mouse to a position relative to the parent window. Here's an example code of it:
# MyWindow
win_activate ("MyWindow");
set_window ("MyWindow ", 2);
win_get_info("MyWindow ", "abs_x", x); # to get it's absolute position
win_get_info("Nova Justificaηγo_1", "abs_y", y);
ax= x+bx;
ay= y+by;
move_locator_abs(ax,ay,0);
click("Left", 2); #For example click the object
type ("Test"); #Write "Test"
To get the values of bx and by, that are relative we have to:
1- Press record;
2- Position your mouse cursor over the objet;
3- Press F2 (don't touch the mouse, your in analogue record mode)
4- Press ALT+F6;
5- Press F2 (so you pass to normal record)
6- Press CTRL+F3 in order to stop recording
If you go to your test you see that a sentence move_locator_abs (nx, ny, 0) was added and the numbers of the function are the coordinates of your unrecognizable object. So to determine bx and by that you are going to substitute in the code above you just have to had x and y to the watch variables and run the code until ay=
(included)
b1 will be b1=x-nx and b2=x-ny
Substitute the value in your script and erase the move_locator_abs (nx, ny, 0)
Now your code is more robust.
|