Page 1 of 1

How to maximize a Metro application.

Posted: Wed Jan 14, 2015 1:12 am
by Brent Arata
Assuming that the element to maximize and to minimize is a WinApp object. There are no forms present within the first page of the application. I would like to do this during a test, not when the test starts.

Re: How to maximize a Metro application.

Posted: Wed Jan 14, 2015 10:33 am
by Support Team
Hello Brent,

I would suggest using a "KeySequence"-action in order to minimize the app. To bring up the window again you could use an "Invoke Action" EnsureVisible().

For example:
MinimizeMaximizeWin8App.png
Note: The "Click()" and "EnsureVisible()" is executed against the metro app (/winapp)

Regards,
Robert

Re: How to maximize a Metro application.

Posted: Mon Jan 19, 2015 8:35 pm
by Brent Arata
Hi Robert,

That solution you posted did not work for me but I was able to get around it by finding the MenuBar and selecting the pinned icon button that resembles our application. Code for this is below:

Code: Select all

MenuBar menuBar;
Host.Local.TryFindSingle<MenuBar>("/menubar[@processname='explorer']", out menuBar);
Button minimizedApp;
menuBar.TryFindSingle<Button>("/button[@accessiblename='Veeva CRM']", out minimizedApp);
minimizedApp.Press();
Invoking the click function on the pinned icon also did not seem to work outside the application, the cursor just moves to the location of the pinned icon. Invoking the press function worked. If you could tell me why there is a change in behavior between press and click would be greatly appreciated.

Re: How to maximize a Metro application.

Posted: Tue Jan 20, 2015 1:06 pm
by Support Team
Hello Brent,

I've tried your code and both functions Press() and Click() worked so far. Just ensure that the "Winapp"-element has focus before executions on of the mentioned methods.

For example:
MenuBar menuBar;
			Host.Local.TryFindSingle<MenuBar>("/menubar[@processname='explorer']", out menuBar);
			Button minimizedApp;
			menuBar.TryFindSingle<Button>(".//toolbar[@accessiblename='Running applications']/button[@accessiblename='Veeva CRM']", out minimizedApp);
			
			WindowsApp app = "/winapp[...]";
			app.Focus();
			
			minimizedApp.Press(); /* or */ minimizedApp.Click();
Regards,
Robert