Thursday, May 15, 2014

How to change the size of the open browser window.

Use the command- driver.manage().window().setSize(new Dimension(int value1, int value2));
where driver is WebDriver type.

ex-

import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class ResizeWindow {
    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
        driver.manage().window().setSize(new Dimension(400,600));
    }
}

No comments:

Post a Comment