How to Maximize the Edge browser?

Class library usage, coding and language questions.
User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

How to Maximize the Edge browser?

Post by Aracknid » Tue Jul 14, 2015 10:03 pm

Hi,

Testing Windows 10 (10162) and Edge browser. Using Ranorex 5.4.0.24580.

If you have a Form object for the Browser, such as IE, you can do MyForm.Maximize.

So I have a WinApp object that represents my Edge browser. You cannot do MyWinApp.Maximize. Is there another easy way to maximize it? I ended up writing code to get the current state, and if the state was not maximized to find the Maximize button and click that. Works, but I thought that was more work than just ".maximize".

Aracknid

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to Maximize the Edge browser?

Post by odklizec » Wed Jul 15, 2015 7:37 am

Hi,

Try to send shortcut ALT + Spacebar + X to Edge window (found it here
http://solverbase.com/w/Edge_Browser:_F ... rtcut_List )
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

jma
Posts: 111
Joined: Fri Jul 03, 2015 9:18 am

Re: How to Maximize the Edge browser?

Post by jma » Thu Jul 16, 2015 2:45 pm

Hi,

you could try the following within your user code. There is an attribute ('State') on the WinApp which could be set.

Code: Select all

repo.WinApp.Self.Element.SetAttributeValue("State",WinForms.FormWindowState.Maximized);
or

Code: Select all

repo.WinApp.Self.As<Form>().Maximize();
Please let me know if this worked out for you.

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: How to Maximize the Edge browser?

Post by Aracknid » Thu Jul 16, 2015 3:48 pm

Interesting, this code worked. I would have thought it would have thrown an exception because a WinApp is not a Form, but perhaps under the covers it is...

Code: Select all

    Dim MyWinApp as Ranorex.WindowsApp
    MyWinApp = Host.Local.FindSingle("./WinApp[@AppID='MicrosoftEdge']")
    MyWinApp.As(Of Ranorex.Form).Maximize
Thanks,

Aracknid

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 the Edge browser?

Post by Support Team » Thu Jul 16, 2015 9:57 pm

Aracknid wrote: I would have thought it would have thrown an exception because a WinApp is not a Form
WinApp indeed is no Form, but the element you are taking about supports multiple capabilities, WinApp and Form being amongst them. You can see all the capabilities supported and their attributes in Ranorex Spy.

The WinApp adapter is just one way of looking at the element, providing a set of properties and methods the element supports. The Form adapter is a different way of looking at the element.

For more information on the terms capability and adapter and how to use them, see following section in the user guide:
http://www.ranorex.com/support/user-gui ... apter.html

Regards,
Alex
Ranorex Team
.
Image