Winappdriver: What is the Windows Maximize Short Key for WinAppDriver ?

Created on 23 May 2018  路  8Comments  路  Source: microsoft/WinAppDriver

Hi,

I am not able to find any Keyboard.PressKey for Maximize the Current Window Screen.

Eg : "Win + Up Arrow" ( Maximize )

Most helpful comment

Hi @timotiusmargo ,

Perfect Answer ! Thank you.

All 8 comments

Does it have to be a hotkey? I believe you can call into Selenium for this. I'm not on my computer with WAP installed, but I think it should be something like Session.Manage().Window.Maximize();

Hi @PandaMagnus ,

I am executing my Application through "WinAppDriver". Now I resolved this issue using the following short cut key.
Keyboard.PressKey(Keys.Alt + Keys.Space + 'x');

But I want to know if any short cut Keys available for "Windows" or "Win" ( Win + Up Arrow ).

@rajeeshmenoth WinAppDriver sits on top of Appium and Selenium, so there should be either a Selenium command, or an equivalent Appium command.

I just checked on my machine with WinAppDriver, and Session.Manage().Window.Maximize(); will work for a regular desktop app.

Hi @PandaMagnus ,

I agree with your points. Do we have any Keys available instead of Session.Manage().Window.Maximize() ?

You mentioned Win + Up Arrow earlier. If that doesn't work, try Alt+Enter, then the X key. Alt+Enter should open the context menu for the application with focus, and hitting the "x" key should invoke the maximize command.

Hi @rajeeshmenoth,

Yes you can indeed invoke the Win + Up Arrow to maximize the application as follows:
c# session.Keyboard.SendKeys(Keys.Command + Keys.ArrowUp + Keys.Command);

Notice the use of Keys.Command for the Win button modifier at the end to release it. A different example of using the Win button can be found below:
https://github.com/Microsoft/WinAppDriver/blob/v1.0/Tests/WebDriverAPI/SendKeys.cs#L122

Hi @timotiusmargo ,

Perfect Answer ! Thank you.

I am also facing the same issue, the only problem is my window is a child of the application window.
Hence In my case my window object is Webelement.

I can't use session handel as it will maximize or minimize the parent window.
There seems to be no way to cast webelement to windowselement
cant set attribute value to an object (Window.WindowVisualState: Maximized (1))

Was this page helpful?
0 / 5 - 0 ratings