selenium.webdriver.common.bidi.script¶
Classes
|
Represents the result of script evaluation. |
|
Represents a realm created event. |
|
Represents a realm destroyed event. |
|
Represents information about a realm. |
Represents the possible realm types. |
|
Represents the possible result ownership types. |
|
|
BiDi implementation of the script module. |
|
Represents a script message event. |
|
Represents the source of a script message. |
- class selenium.webdriver.common.bidi.script.ResultOwnership[source]¶
Represents the possible result ownership types.
- NONE = 'none'¶
- ROOT = 'root'¶
- class selenium.webdriver.common.bidi.script.RealmType[source]¶
Represents the possible realm types.
- WINDOW = 'window'¶
- DEDICATED_WORKER = 'dedicated-worker'¶
- SHARED_WORKER = 'shared-worker'¶
- SERVICE_WORKER = 'service-worker'¶
- WORKER = 'worker'¶
- PAINT_WORKLET = 'paint-worklet'¶
- AUDIO_WORKLET = 'audio-worklet'¶
- WORKLET = 'worklet'¶
- class selenium.webdriver.common.bidi.script.RealmInfo(realm: str, origin: str, type: str, context: str | None = None, sandbox: str | None = None)[source]¶
Represents information about a realm.
- realm: str¶
- origin: str¶
- type: str¶
- context: str | None = None¶
- sandbox: str | None = None¶
- class selenium.webdriver.common.bidi.script.Source(realm: str, context: str | None = None)[source]¶
Represents the source of a script message.
- realm: str¶
- context: str | None = None¶
- class selenium.webdriver.common.bidi.script.EvaluateResult(type: str, realm: str, result: dict | None = None, exception_details: dict | None = None)[source]¶
Represents the result of script evaluation.
- type: str¶
- realm: str¶
- result: dict | None = None¶
- exception_details: dict | None = None¶
- classmethod from_json(json: dict[str, Any]) EvaluateResult [source]¶
Creates an EvaluateResult instance from a dictionary.
Parameters:¶
json: A dictionary containing the evaluation result.
Returns:¶
EvaluateResult: A new instance of EvaluateResult.
- class selenium.webdriver.common.bidi.script.ScriptMessage(channel: str, data: dict, source: Source)[source]¶
Represents a script message event.
- event_class = 'script.message'¶
- classmethod from_json(json: dict[str, Any]) ScriptMessage [source]¶
Creates a ScriptMessage instance from a dictionary.
Parameters:¶
json: A dictionary containing the script message.
Returns:¶
ScriptMessage: A new instance of ScriptMessage.
- class selenium.webdriver.common.bidi.script.RealmCreated(realm_info: RealmInfo)[source]¶
Represents a realm created event.
- event_class = 'script.realmCreated'¶
- classmethod from_json(json: dict[str, Any]) RealmCreated [source]¶
Creates a RealmCreated instance from a dictionary.
Parameters:¶
json: A dictionary containing the realm created event.
Returns:¶
RealmCreated: A new instance of RealmCreated.
- class selenium.webdriver.common.bidi.script.RealmDestroyed(realm: str)[source]¶
Represents a realm destroyed event.
- event_class = 'script.realmDestroyed'¶
- classmethod from_json(json: dict[str, Any]) RealmDestroyed [source]¶
Creates a RealmDestroyed instance from a dictionary.
Parameters:¶
json: A dictionary containing the realm destroyed event.
Returns:¶
RealmDestroyed: A new instance of RealmDestroyed.
- class selenium.webdriver.common.bidi.script.Script(conn, driver=None)[source]¶
BiDi implementation of the script module.
- EVENTS = {'message': 'script.message', 'realm_created': 'script.realmCreated', 'realm_destroyed': 'script.realmDestroyed'}¶
- remove_javascript_error_handler(id)¶
- pin(script: str) str [source]¶
Pins a script to the current browsing context.
Parameters:¶
script: The script to pin.
Returns:¶
str: The ID of the pinned script.
- unpin(script_id: str) None [source]¶
Unpins a script from the current browsing context.
Parameters:¶
script_id: The ID of the pinned script to unpin.
- execute(script: str, *args) dict [source]¶
Executes a script in the current browsing context.
Parameters:¶
script: The script function to execute. *args: Arguments to pass to the script function.
Returns:¶
dict: The result value from the script execution.
Raises:¶
WebDriverException: If the script execution fails.