This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Not able to launch web application in maximized mode

Hello All

Need help

I am trying to launch application  with below code but my application always launched in minimized mode

browser =BrowserFactory.launch(BrowserType.CHROME);
browser.navigate(url);

Just to explain further the issue:

1)No existing browser is opened: I am running script from eclipse.  script opens new chrome browser but it left minimized in taskbar and blinks . eclipse is still maximized and I have to click the browser to maximize it.. Not as expected

2)If i have existing chrome browser opened and it is minimizedI am running script from eclipse. script opens new chrome browse in maximize mode.. This is fine

2)If i have existing chrome browser opened and it is maximized  but hidden behind eclipse: I am running script from eclipse. script opens new chrome browse in minimized mode  like scenario 1 and I have to  click the browser to maximize it.. Not as expected

I want my application to be launched always in Maximized mode .Please help

Thanks

Devkant

  • Suggested Answer

    0

    i just use windows keyboard shortcuts during my application login automation, (maybe you could put it under @Before tag) to maximize current window.  not exactly what you're asking but it works.

      public static void maximizeWindowUsingKeyboardShortcut() throws Exception
      {
        // use windows keyboard shortcut to maximize active window.
        Keyboard.keyDown(Keys.LEFT_SYSTEM);
        Keyboard.pressKey(Keys.UP);
        Keyboard.keyUp(Keys.LEFT_SYSTEM);
      }

  • 0 in reply to 

    Thanks for your reply

    unfortunately. This did not work for me.. Just to explain further the issue:

    1)No existing browser is opened: I am running script from eclipse.  script opens new chrome browser but it left minimized in taskbar and blinks . eclipse is still maximized and I have to click the browser to maximize it.. Not as expected

    2)If i have existing chrome browser opened and it is minimizedI am running script from eclipse. script opens new chrome browse in maximize mode.. This is fine

    2)If i have existing chrome browser opened and it is maximized  but hidden behind eclipse: I am running script from eclipse. script opens new chrome browse in minimized mode  like scenario 1 and I have to  click the browser to maximize it.. Not as expected

  • 0 in reply to 

    Hi 

    below line of code helped in scenario2 and 3 but I still need help in scenario1 when there is no existing browser opened and i believe this is most frequent scenario. Please help

    Keyboard.keyDown(Keys.LEFT_SYSTEM);
    Keyboard.pressKey(Keys.D);
    Keyboard.keyUp(Keys.LEFT_SYSTEM);

    Thanks

    Devkant

  • Suggested Answer

    0   in reply to 

    Hi Devkant, 

    Can you try below code. It should be used after you launch Chrome browser. 

           

    //Execute the Standard Windows commands

    Window stdBrowser = env.describe(Window.class, new WindowDescription.Builder().windowTitleRegExp(" Google Chrome").index(1).build());

     stdBrowser.activate();

     stdBrowser.maximize();

    Hope that it could help !

    Thanks, 
    Lien