Maximize the browser page in IE

Class library usage, coding and language questions.
omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Maximize the browser page in IE

Post by omayer » Mon Jul 11, 2011 8: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

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Maximize the browser page in IE

Post by Ciege » Mon Jul 11, 2011 9: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...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Maximize the browser page in IE

Post by omayer » Tue Jul 12, 2011 2:33 am

Thank you ciege, its worked.
Tipu

User avatar
sdaly
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: Maximize the browser page in IE

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

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Maximize the browser page in IE

Post by omayer » Fri Jul 15, 2011 12:23 am

Thank you Scott, it worked except i didn't want the browser at full screen.
Beginner

User avatar
sdaly
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: Maximize the browser page in IE

Post by sdaly » Fri Jul 15, 2011 8:04 am

Ah, maybe root.Browser.Maximize() :P

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

Re: Maximize the browser page in IE

Post by Support Team » Fri Jul 15, 2011 9: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
.
Image

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Maximize the browser page in IE

Post by omayer » Sun Jul 17, 2011 6:26 am

Thank you all, code example please.
Beginner

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

Re: Maximize the browser page in IE

Post by Support Team » Mon Jul 18, 2011 11:37 am

Hi,

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

Kind regards,
Tobias
Support Team
.
Image