2

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());
    }
plaidshirt
  • 5,189
  • 19
  • 91
  • 181

2 Answers2

1

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

Motti
  • 110,860
  • 49
  • 189
  • 262
1

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.

Adelin
  • 7,809
  • 5
  • 37
  • 65
  • 1
    As I see `getPage()` doesn't have `sendKeys()` method. – plaidshirt May 14 '18 at 13:17
  • @plaidshirt I apologize, you are correct. `sendKeys` is supported only on `EditField` interface. Do you have such an element on a page? If not you could inject one temporarily, but it would be a hacky solution and I'm not 100% sure it'll work – Adelin May 14 '18 at 13:22
  • Yes and sendKeys() is instable too, I used it earlier. Than maybe an AutoIT script could be a solution, but it is not so lightweight solution. – plaidshirt May 14 '18 at 13:28