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));
}
}
Regards