Maximize browser window in LeanFT

983 Views Asked by At

I am looking for some solution, like this in Selenium WebDriver:

ChromeOptions options = new ChromeOptions();options.addArgument("--start-maximized");

So browser window should be maximized when test is executed.

I found a profile based solution for this problem, but it opens a lot of tabs, which is maybe caused by escape characters.

@Test
    public void chromeWithProfileLaunch() throws Exception {
        String profileDir = "--user-data-dir=\"c:\\Temp\\profile1\""; //should be different folder every time
        String leanftChromeExtension = "--load-extension=C:\\Program Files (x86)\\HPE\\LeanFT\\Installations\\Chrome\\Extension"; //to load the LeanFT extension
        String homePage = "www.google.com"; //the homepage to start with

        new ProcessBuilder("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", profileDir, leanftChromeExtension, homePage)
            .start();

        Thread.sleep(2000); //wait for Chrome process to load

        Browser openedBrowser = BrowserFactory.attach(new BrowserDescription.Builder().title("Google").type(BrowserType.CHROME).build());

        Verify.areEqual(homePage, openedBrowser.getURL());
    }
2

There are 2 best solutions below

0
Motti On BEST ANSWER

I don't know about maximized but LeanFT supports putting the browser in fullScreen mode.

3
Adelin On

LeanFT doesn't support maximize() out of the box yet.

However, you could use sendKeys() method. I'm not entirely sure if you can to it on the browser instance directly, or you need to getPage() first, but you can definitelly send Super key (win key) + as specified here. for restoring back to the initial state.

Here's an example using sendKeys with Java SDK if you need it.