---
title: Change browser window size with Selenium
description: Learn how to resize or maximize a browser window during Selenium test
  sessions.
source_url:
  html: https://testingbot.com/support/web-automate/selenium/browser-window-size
  md: https://testingbot.com/support/web-automate/selenium/browser-window-size/index.md
---
# Maximize or resize browser window

Selenium WebDriver makes it possible to resize and maximize a browser window during an automated test.   
 Below you'll find examples on how to:

- [Maximize a window](https://testingbot.com#maximize)
- [Resize a window](https://testingbot.com#resize)

## Maximize a window

The example below shows how to maximize the window to the full screen resolution (you can [change the screen resolution](https://testingbot.com/support/web-automate/selenium/change-screen-resolution) as well).

[Java](https://testingbot.com#)[Python](https://testingbot.com#)[NodeJS](https://testingbot.com#)[Ruby](https://testingbot.com#)[PHP](https://testingbot.com#)[C#](https://testingbot.com#)

    driver.manage().window().maximize();

    driver.maximize_window()

    await driver.manage().window().maximize();

    driver.manage.window.maximize

    $web_driver->manage()->window()->maximize();

    driver.Manage().Window.Maximize();

Maximizing a window will only work on desktop browsers, not on mobile.

## Resize a window

The example below shows how to resize the current window. If you specify a size larger than the current resolution, elements may appear off-screen.   
 Find out how to [change the screen resolution](https://testingbot.com/support/web-automate/selenium/change-screen-resolution).

[Java](https://testingbot.com#)[Python](https://testingbot.com#)[NodeJS](https://testingbot.com#)[Ruby](https://testingbot.com#)[PHP](https://testingbot.com#)[C#](https://testingbot.com#)

    Dimension dimension = new Dimension(1920, 1080);
    driver.manage().window().setSize(dimension);

    driver.set_window_size(1920, 1080)

    await driver.manage().window().setRect({ width: 1920, height: 1080 });

    driver.manage.window.resize_to(1920, 1080)

    $web_driver->manage()->window()->setSize(new WebDriverDimension(1920, 1080));

    driver.Manage().Window.Size = new Size(1920, 1080);

Resizing a window will only work on desktop browsers, not on mobile.

### Looking for more help?

Have questions or need more information? Reach out via email or Slack.

[Email us](https://testingbot.com/contact/new)[Slack Join our Slack](https://join.slack.com/t/testingb0t/shared_invite/zt-3bcw9xch-jk19~6XPs_xBrsAgAedkCw)
