mokr.frame.manager

Module Contents

Classes

FrameManager

This class is an assistant class that helps with mokr.frame.Frame

Attributes

LOGGER

mokr.frame.manager.LOGGER
class mokr.frame.manager.FrameManager(client: mokr.connection.DevtoolsConnection, frame_tree: dict, page: mokr.browser.page.Page)

Bases: pyee.EventEmitter

This class is an assistant class that helps with mokr.frame.Frame management by creating them and by managing `mokr.execution.ExecutionContext`s.

Parameters:
  • client (DevtoolsConnection) – mokr.execution.ExecutionContext of the mokr.browser.Page that spawned this.

  • frame_tree (dict) – A representation of the hierarchy of remote frames on a page.

  • page (Page) – The spawning mokr.browser.Page object.

property main_frame: mokr.frame.frame.Frame | None

The main remote frame (top of the frame tree).

frames() list[mokr.frame.frame.Frame]

A list of all mokr.frame.Frame objects under this manager.

Returns:

All `mokr.frame.Frame`s controlled by this class.

Return type:

list[Frame]

frame(frame_id: str) mokr.frame.frame.Frame | None

Return a frame with the given frame_id, if any.

Parameters:

frame_id (str) – Remote frame identifier.

Returns:

mokr.frame.Frame, if any match given frame_id.

Return type:

Frame | None

execution_context_by_id(context_id: str) mokr.execution.context.ExecutionContext

Get a mokr.execution.ExecutionContext under this manager.

Parameters:

context_id (str) – Target context identifier.

Raises:

ElementHandleError – Raised if no context matches context_id.

Returns:

mokr.execution.ExecutionContext created

by this FrameManager with given context_id.

Return type:

ExecutionContext

create_javascript_handle(context: mokr.execution.context.ExecutionContext, remote_object: dict = None) mokr.execution.context.JavascriptHandle

Create a mokr.execution.JavascriptHandle for given context.

Parameters:
  • context (ExecutionContext) – mokr.execution.ExecutionContext to pass into initialisation.

  • remote_object (dict, optional) – Remote object to be represented by new mokr.execution.JavascriptHandle. Defaults to None.

Returns:

_description_

Return type:

JavascriptHandle