Saturday, August 25, 2012

How to maximize Browser window in Selenium Webdriver

 

Sometimes we need to maximize our browser window at the time of automation. Selenium webdriver have given us a nice command to execute such instruction.

We have a webdriver object named “driver” and we need to make our browser window maximize. The command will be

driver.manage().window().maximize(); //Java code

4 comments:

  1. Thanks .......code works

    ReplyDelete
  2. Thanks for simple step to solve to problem

    ReplyDelete
  3. driver.manage().window().maximize();
    this is not correct java code for maximize browser..
    correct code is
    Dimension arg0 = null;
    driver.manage().window().setSize(arg0);

    ReplyDelete