mokr.execution.handle.javascript

Module Contents

Classes

JavascriptHandle

Representative of a JavaScript object within the frame.

Attributes

LOGGER

mokr.execution.handle.javascript.LOGGER
class mokr.execution.handle.javascript.JavascriptHandle(context: mokr.execution.context.ExecutionContext, client: mokr.connection.DevtoolsConnection, remote_object: dict)

Representative of a JavaScript object within the frame. JavascriptHandles are created automatically by mokr.frame.FrameManager and mokr.browser.WebWorker.

Parameters:
  • context (ExecutionContext) – mokr.execution.ExecutionContext of the mokr.frame.FrameManager that spawned this.

  • client (DevtoolsConnection) – Remote connection from parent.

  • remote_object (dict) – The raw response from the remote connection representing the object.

property execution_context: mokr.execution.context.ExecutionContext

Get mokr.execution.ExecutionContext of this handle.

async get_property(property_name: str) JavascriptHandle

Get a property of the remote object related to this handle.

Parameters:

property_name (str) – Name of the target property.

Returns:

Newly created JavascriptHandle from the result.

Return type:

JavascriptHandle

async get_properties() dict[str, JavascriptHandle]

Get all properties of the remote object related to this handle.

Returns:

Dictionary keyed as “property name” to

newly created `JavascriptHandle`s from the results.

Return type:

dict[str, JavascriptHandle]

async json() dict

Get and JSONify the values of the remote object this handle represents.

Returns:

Dictionary of JSONified values.

Return type:

dict

async dispose() None

Stop referencing this handle. Allows it to be garbage-collected by the browser.

to_string() str

Get a string representation of the remote object this represents.

Returns:

String representation of remote object. May contain

object data or just the type.

Return type:

str