Forum Discussion

kdle's avatar
kdle
Frequent Visitor
6 years ago

Maximize web browser window in TestLeft

Pls help. I'm new to TestLeft and I'm looking for a method in C# to maximize/assert a web browser window for the When and Then steps in the example below:     [Given(@"I have navigated to the g...
  • AlexKaras's avatar
    6 years ago

    Hi,

     

    ITopLevelWindow of desktop application provides the .Maximize() method.

    The call may be like this:

    ITopLevelWindow browserWindow = driver.Find<IWebBrowser>(new WebBrowserPattern(){ 
    	ObjectIdentifier = "firefox" 
    }).Find<ITopLevelWindow>(new WebBrowserUIPattern(){ 
    	ObjectType = "BrowserWindow", 
    	ObjectIdentifier = 0 
    });
    
    browserWindow.Maximize();

     

    Also, the same can be achieved from the Page object:

    IWebPage page = driver.Find<IWebBrowser>(new WebBrowserPattern(){ 
    	ObjectIdentifier = "firefox" 
    }).Find<IWebPage>(new WebPagePattern(){ 
    	URL = "http://somesite.com/*" 
    });
    
    page.CallMethod("maximize");