Hi Punit, you can use following code snippet to resize browser window using Selenium Webdriver:
package dummy;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
public class ResizeBrowser {
@Test
public void launchBrowser() {
System.setProperty("webdriver.gecko.driver","D://SeleniumDrivers//geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://www.google.com");
System.out.println(driver.manage().window().getSize());
//Create object of Dimensions class
Dimension d = new Dimension(480,620);
//Resize the current window to the given dimension
driver.manage().window().setSize(d);
System.out.println(driver.manage().window().getSize());
}
}