How To Resize Browser Window Using Selenium WebDriver

In this post, we see how to Resize Browser Window using Selenium WebDriver. In some cases, we may need to resize browser window to some fixed dimensions, particularly when we are testing for responsive web design because we need to check to see how the different elements on the page render when we resize the browser window. Using Selenium WebDriver we could Resize Browser Window size. It allows resizing and maximizing window natively from its API.

Also Read: How To Scroll Web page Using Selenium WebDriver

To resize browser window to particular dimensions, we use ‘Dimension’ class to resize the browser window.

We know how to maximize the browser window to the maximum width and height of the screen.

The below code opens the SoftwareTestingMaterial website and then set the browser window size to 480*620 .

If you are not regular reader of my blog then I highly recommend you to signup for the free email newsletter using the below link.

Resize Browser Window

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

1 thought on “How To Resize Browser Window Using Selenium WebDriver”

  1. Hi,

    Very nice Interview Questions of Selenium and Manual Testing

    Thank you very much for Posting.

Leave a Comment

Share via
Copy link
Powered by Social Snap