Skip to main content

ChangeWindowSize

This class provides a context manager for temporarily modifying the dimensions of a Selenium browser window. It captures the current window size upon entry, applies the specified width and height, and automatically restores the original dimensions when the context is exited.

Attributes

AttributeTypeDescription
seleniumWebDriverThe Selenium WebDriver instance used to manage and resize the browser window.
new_sizetuple(int, int)A tuple containing the target width and height dimensions to be applied to the browser window.
old_sizedictStores the original browser window dimensions captured upon entering the context to allow for restoration on exit.

Constructor

Signature

def ChangeWindowSize(
width: int,
height: int,
selenium: object
) - > null

Parameters

NameTypeDescription
widthintThe target width for the browser window.
heightintThe target height for the browser window.
seleniumobjectThe Selenium WebDriver instance to be resized.