Check if IE Window Maximized and In Foreground

Hi all,

Does anyone know of a way to check if a given window is maximized and in the foreground? For the process I am creating it would be helpful to be able to check if a specific tab in IE is visible and maximized.

I have tried using the UiExplorer to look for any properties which change with being maximized or in the foreground, but could not find any.

I also tried using the Find Element activity with WaitVisible and WaitActive selected inside a try-catch to try to check for whether the element is in the foreground. The idea is that the Find Element should throw an error if the window is not visible or not active, but not if the window is visible and active. However, from what I can tell, WaitVisible and WaitActive have absolutely no effect on the activity behavior (the element is found even when I minimize it).

Does anyone have a solution to this? Am I missing something obvious, like an activity designed to perform this check? If not, it seems like this would be a useful feature for a UI automation platform.

Thanks in advance for any help. You can try

Element on Appear Activity , where as in properties pane make Repeat Forever as false and Check the Wait Visible and inside the Do block perform the action which you want to perform once your element is visible.

@Rashmi thanks for the reply. That seems to work for checking whether it is in the foreground. Do you know of a way to check whether the window is maximized?

Use maximize window property and true in continue on error property, and put the windows property as the window you want to maximize

Pavan H

So, you just want to check whether its minimize or maximized or you want to maximize as well if your window is minimized.

If that so, in first case use the above activity which i have mentioned before and have condition true or false .

and if you want to maximize it, then use directly Maximize window this activity will maximize your window even if it’s already maximized.

@pavanh003 I am really trying to check whether the window is maximized or not. You are right that most of the time just using the Maximize Window activity would work, but I would much prefer to be able to check this property rather than constantly re-maximizing the window.

FYI, Maximize Window does not throw an error if the window is already maximized.

1 Like

The way that I intend to use this is as part of a recovery sequence. In order to tell the robot whether or not to enter into that recovery sequence, I need to be able to check if the window is no longer maximized (this indicates something went wrong and we need to enter the recovery). The method you sent me works for checking if the element is in the foreground (active), but it does not work for checking whether the window is maximized. I could call the Maximize activity every time I check whether the recovery needs to be run, but this would end up calling Maximize many many times. If that is the only solution then I can live with that, but I would really like to find a way to check for maximization.

In this case you can use Get Attribute activity ,

Where as indicate the Top row of the browser

And in attribute give “visibility” , after this create output variable and then have one If condition
If it returns 0 that means window is Maximized and else its minimized .

Hope this will help you.

1 Like