mokr.cdp.frame.manager

Attributes

LOGGER

Classes

CdpFrameManager

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

Module Contents

mokr.cdp.frame.manager.LOGGER
class mokr.cdp.frame.manager.CdpFrameManager(client: mokr.cdp.connection.CdpSession, frame_tree: dict, page: mokr.cdp.browser.page.CdpPage)

Bases: pyee.EventEmitter

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

Parameters:
  • client (CdpSession) – mokr.cdp.execution.CdpExecutionContext 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.cdp.frame.frame.CdpFrame | None

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

frames() → list[mokr.cdp.frame.frame.CdpFrame]

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.cdp.frame.frame.CdpFrame | 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.cdp.execution.context.CdpExecutionContext

Get a mokr.cdp.execution.CdpExecutionContext under this manager.

Parameters:

context_id (str) – CdpTarget context identifier.

Raises:

ElementHandleError – Raised if no context matches context_id.

Returns:

mokr.cdp.execution.CdpExecutionContext created

by this CdpFrameManager with given context_id.

Return type:

CdpExecutionContext

create_javascript_handle(context: mokr.cdp.execution.context.CdpExecutionContext, remote_object: dict = None) → mokr.cdp.execution.context.CdpJavascriptHandle

Create a mokr.cdp.execution.CdpJavascriptHandle for given context.

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

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

Returns:

_description_

Return type:

CdpJavascriptHandle