javagoogle-chromeleanft

Maximize browser window in LeanFT


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

Solution

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