Interview Questions

WinRunner: How to test to see if the window is maximized

Mercury WinRunner FAQ


(Continued from previous question...)

WinRunner: How to test to see if the window is maximized

If you want to test to see if the window is maximized here is a sample of how to code it. This code would be best used in the start up script of any automation project.
#first grab the windows handle for the netsoft elite window
win_get_info("Browser Main Window ","handle",value);
#now test to see if window can be maximized
if(win_check_info("Browser Main Window ","maximizable",FALSE)!=E_OK)
{
#Now run maximize function and pass in the handle's value
if (is_maximized(value) == E_OK)
{
report_msg("Ran Max window test and maxed the window");
win_max("Browser Main Window ");
}
else
{
report_msg("Ran Max window test and did not have to do anything");
}
}
# end of script

(Continued on next question...)

Other Interview Questions