webdriver, window size, dimension

The below code will get the current size (height, width ) of the window (browser) , if we need to change the size , we can use the Demension class and set the width and height.


FirefoxDriver driver=new FirefoxDriver();
driver.get("http://www.google.com");

Dimension d=driver.manage().window().getSize();
System.out.println("initial height :"+d.height);
System.out.println("initial width :"+d.width);

driver.manage().window().setSize(new Dimension(800,600));

Comments