viewport

The command to control the size and orientation of the current browser window.

Syntax

py.viewport(width: int, height: int) -> Pylenium
py.viewport(width: int, height: int, orientation: str) -> Pylenium

Usage

correct usage
py.viewport(1280, 800) # macbook-13 size

Arguments

  • width (int) - The width in pixels

  • height (int) - The height in pixels

  • orientation="portrait" (str) - Pass "landscape" to reverse the width and height

Yields

  • Pylenium - The current instance of Pylenium so you can change commands

Examples

py.viewport(1280, 800) # macbook-13 size
py.viewport(1440, 900) # macbook-15 size
py.viewport(375, 667, orientation="landscape")  # iPhone X size

Last updated