mokr.browser.viewport
Module Contents
Classes
Handler for adjusting the browser viewport. Can adjust size and |
- class mokr.browser.viewport.ViewportManager(client: mokr.connection.connection.DevtoolsConnection)
Handler for adjusting the browser viewport. Can adjust size and enable functionality such as touchmode.
- Parameters:
client (DevtoolsConnection) –
mokr.network.DevtoolsConnectionobject, shared from the parentmokr.browser.Page.
- async emulate_viewport(viewport: dict[str, bool | int]) bool
Run viewport adjustments based off given
viewportparameters. Not all viewport options are considered, only: “isMobile”, “width”, “height”, “deviceScaleFactor”, “isLandscape”, and “hasTouch”.- Parameters:
viewport (dict[str, bool | int]) – The parameters to adjust the viewport to.
- Raises:
TypeError – Raised if “width” or “height” in
viewportare not positive integers.- Returns:
- True to indicate if a reload of the page is needed to affect
the changes sent. False if not.
- Return type:
bool