Maximize the browser page in IE : Automation API

Maximize the browser page in IE

Class library usage, coding and language questions.

Maximize the browser page in IE

Postby omayer » Mon Jul 11, 2011 9:19 pm

in code- How to use try and catch for the following scenario
a. -Maximize the browser if itsn't open at fullscreen or maximized.


Code: Select all
     public void OpenBrowser()
        
        {     
           
         System.Diagnostics.Process.Start("iexplore.exe", url);   
       
        }


Thank you.
Omayer
Tipu
omayer
 
Posts: 240
Joined: Thu Oct 28, 2010 7:14 pm

Re: Maximize the browser page in IE

Postby Ciege » Mon Jul 11, 2011 10:54 pm

Not sure what try/catch has to do with your question, but you can add startInfo properties to your start command that tells the browser to open maximized...

Code: Select all
ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
startInfo.Arguments = myURL;
Process.Start(startInfo);
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...
User avatar
Ciege
 
Posts: 965
Joined: Thu Oct 16, 2008 7:46 pm
Location: Arizona, USA

Re: Maximize the browser page in IE

Postby omayer » Tue Jul 12, 2011 3:33 am

Thank you ciege, its worked.
Tipu
omayer
 
Posts: 240
Joined: Thu Oct 28, 2010 7:14 pm

Re: Maximize the browser page in IE

Postby sdaly » Tue Jul 12, 2011 9:17 am

For reference, another way to do this when you don't have control over the start up info (example if you click a link and it loads up the page in the browser) is

Code: Select all
   try {
            Ranorex.WebDocument root = "rxpath to dom";
            root.FullScreen = true;
         } catch (Exception){
            Report.Warn("Failed to maximise dash.");
            
         }
User avatar
sdaly
 
Posts: 213
Joined: Mon May 10, 2010 12:04 pm
Location: Dundee, Scotland

Re: Maximize the browser page in IE

Postby omayer » Fri Jul 15, 2011 1:23 am

Thank you Scott, it worked except i didn't want the browser at full screen.
Beginner
omayer
 
Posts: 240
Joined: Thu Oct 28, 2010 7:14 pm

Re: Maximize the browser page in IE

Postby sdaly » Fri Jul 15, 2011 9:04 am

Ah, maybe root.Browser.Maximize() :P
User avatar
sdaly
 
Posts: 213
Joined: Mon May 10, 2010 12:04 pm
Location: Dundee, Scotland

Re: Maximize the browser page in IE

Postby Support Team » Fri Jul 15, 2011 10:49 am

With 3.1 the Host.OpenBrowser and RunApplication methods will also support a "maximized" argument. If passing "true" for that argument, the browser/application will be maximized after being started.

Regards,
Alex
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Maximize the browser page in IE

Postby omayer » Sun Jul 17, 2011 7:26 am

Thank you all, code example please.
Beginner
omayer
 
Posts: 240
Joined: Thu Oct 28, 2010 7:14 pm

Re: Maximize the browser page in IE

Postby Support Team » Mon Jul 18, 2011 12:37 pm

Hi,

Ranorex 3.1 has not been released yet, but will be in the near future.

Kind regards,
Tobias
Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests