Browser.Maximize() on two different machine

Ask general questions here.
TestEngineer
Posts: 31
Joined: Tue Jun 22, 2021 10:12 am

Browser.Maximize() on two different machine

Post by TestEngineer » Wed Nov 24, 2021 5:30 pm

Hello All

I am running ranorex test on two different test machine one is my laptop and the other one is the remote desktop

With remote desktop chrome browser always opened in normal state , I have written a user code module that if browser opened in a normal state than my usercode should maximized the browser which works like if browser opened in Normal mode my usercode maximized it
The problem arise when browser already opened in maximize mode still through my usercode it clicked on the maximized button and shift my browser to normal mode
I want that if browser opened in maximize mode than nothing happened and it should move on , only when it opened in normal mode it should be maximized using my written below user code.

I already checked/used Action:Maximized in my OpenBrowser recording , my browser does not maximized that is why i have to write this block of user code

Code: Select all

  void ITestModule.Run()
        {
        	Mouse.DefaultMoveTime = 300;
        	Keyboard.DefaultKeyPressTime = 100;
        	Delay.SpeedFactor = 1.0;
        	
        	string BeforeBrowserState = repo.Browser.Element.GetAttributeValueText("State");
        	Report.Info("Info", string.Format("Current Browser State : {0}.", BeforeBrowserState));
        	if(BeforeBrowserState == "Normal")
        	{
        		repo.Browser.Maximize();
        		string AfterBrowserState = repo.Browser.Element.GetAttributeValueText("State");
        		
        		Report.Info("Info", string.Format("Browser has been maximized : {0}.", AfterBrowserState));
        	}
        	else
        	{
        		string test = repo.Browser.Element.GetAttributeValueText("State");
        		Report.Info("Info", string.Format("Browser state : {0}.",test));
        	}
        }

Any help in this

Regards

User avatar
doke
Posts: 112
Joined: Fri Mar 29, 2019 2:33 pm

Re: Browser.Maximize() on two different machine

Post by doke » Mon Nov 29, 2021 6:15 pm

you could try on the active application ( possibly no item will work aswell if you already did interaction)
key sequence {LWin down}{Up}{LWin up}

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Browser.Maximize() on two different machine

Post by Fergal » Thu Dec 02, 2021 11:53 am

Instead of using user code, could you always open the browser in Maximized mode?


OpenBrowser.PNG
You do not have the required permissions to view the files attached to this post.