[Selenium] Maxmize Web Browser Window Size

[Tips For Selenium]

Maxmize Web Browser Window Size

Firefox & IE

System.setProperty("webdriver.gecko.driver", "C:/webdriver/geckodriver64.exe");
WebDriver driver = new FirefoxDriver();


ChromeOptions co = new ChromeOptions();

System.setProperty("webdriver.chrome.driver", "C:/webdriver/chromedriver.exe");
WebDriver driver = new ChromeDriver(co);

Screen Capture


Rectangle captureSize = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
Robot robot = new Robot();
BufferedImage bufferedImage = robot.createScreenCapture(captureSize);
File file = new File("c:\\webdriver\\capturedImages\\capture1.png");
ImageIO.write(bufferedImage, "png", file);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s