How to maximize a Metro application.

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Brent Arata
Posts: 12
Joined: Mon Jan 27, 2014 10:33 pm

How to maximize a Metro application.

Post by Brent Arata » Wed Jan 14, 2015 1:12 am

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to maximize a Metro application.

Post by Support Team » Wed Jan 14, 2015 10:33 am

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
MinimizeMaximizeWin8App.png (18.78 KiB) Viewed 775 times
Note: The "Click()" and "EnsureVisible()" is executed against the metro app (/winapp)

Regards,
Robert
.
Image

Brent Arata
Posts: 12
Joined: Mon Jan 27, 2014 10:33 pm

Re: How to maximize a Metro application.

Post by Brent Arata » Mon Jan 19, 2015 8:35 pm

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to maximize a Metro application.

Post by Support Team » Tue Jan 20, 2015 1:06 pm

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
.
Image