Page 1 of 1

Maximize the browser page in IE

Posted: Mon Jul 11, 2011 8:19 pm
by omayer
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

Re: Maximize the browser page in IE

Posted: Mon Jul 11, 2011 9:54 pm
by Ciege
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);

Re: Maximize the browser page in IE

Posted: Tue Jul 12, 2011 2:33 am
by omayer
Thank you ciege, its worked.

Re: Maximize the browser page in IE

Posted: Tue Jul 12, 2011 8:17 am
by sdaly
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.");
				
			}

Re: Maximize the browser page in IE

Posted: Fri Jul 15, 2011 12:23 am
by omayer
Thank you Scott, it worked except i didn't want the browser at full screen.
Beginner

Re: Maximize the browser page in IE

Posted: Fri Jul 15, 2011 8:04 am
by sdaly
Ah, maybe root.Browser.Maximize() :P

Re: Maximize the browser page in IE

Posted: Fri Jul 15, 2011 9:49 am
by Support Team
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

Re: Maximize the browser page in IE

Posted: Sun Jul 17, 2011 6:26 am
by omayer
Thank you all, code example please.
Beginner

Re: Maximize the browser page in IE

Posted: Mon Jul 18, 2011 11:37 am
by Support Team
Hi,

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

Kind regards,
Tobias
Support Team