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.

Sharing is caring.

Share on facebook
Share on twitter
Share on linkedin

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

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

Leave a Comment

Your email address will not be published. Required fields are marked *

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook