screen_capture_mixin

A mixin class providing common methods for devices that can perform screen captures.

ScreenCaptureMixin

Bases: ABC

flowchart LR tm_devices.driver_mixins.abstract_device_functionality.screen_capture_mixin.ScreenCaptureMixin[ScreenCaptureMixin] click tm_devices.driver_mixins.abstract_device_functionality.screen_capture_mixin.ScreenCaptureMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.screen_capture_mixin.ScreenCaptureMixin"

A mixin class providing common methods for devices that can perform screen captures.

valid_image_extensions abstractmethod property

valid_image_extensions: tuple[str, ...]

Return a tuple of valid image extensions for this device.

The extensions will be in the format ‘.ext’, where ‘ext’ is the lowercase extension, e.g. (“.png”, “.jpg”).

Returns:
  • tuple[str, ...]

    Tuple[str, …]: A tuple of valid, lowercase image extensions for this device.

save_screenshot

save_screenshot(
    filename: str | PathLike[str] | None = None,
    *,
    colors: str | None = None,
    view_type: str | None = None,
    local_folder: str | PathLike[str] = "./",
    device_folder: str | PathLike[str] = "./",
    keep_device_file: bool = False
) -> None

Capture a screenshot from the device and save it locally.

Parameters:
  • filename (str | PathLike[str] | None, default: None ) –

    The name of the file to save the screenshot as. Defaults to a timestamped name using the first valid image extension.

  • colors (str | None, default: None ) –

    The color scheme to use for the screenshot. (Not used by all devices)

  • view_type (str | None, default: None ) –

    The type of view to capture. (Not used by all devices)

  • local_folder (str | PathLike[str], default: './' ) –

    The local folder to save the screenshot in. Defaults to “./”.

  • device_folder (str | PathLike[str], default: './' ) –

    The folder on the device to save the screenshot in. Defaults to “./”.

  • keep_device_file (bool, default: False ) –

    Whether to keep the file on the device after downloading it. Defaults to False.