@@ -60,12 +60,10 @@ class RealmInfo:
6060 def from_json (cls , json : dict [str , Any ]) -> "RealmInfo" :
6161 """Creates a RealmInfo instance from a dictionary.
6262
63- Parameters:
64- -----------
63+ Args:
6564 json: A dictionary containing the realm information.
6665
6766 Returns:
68- -------
6967 RealmInfo: A new instance of RealmInfo.
7068 """
7169 if "realm" not in json :
@@ -95,12 +93,10 @@ class Source:
9593 def from_json (cls , json : dict [str , Any ]) -> "Source" :
9694 """Creates a Source instance from a dictionary.
9795
98- Parameters:
99- -----------
96+ Args:
10097 json: A dictionary containing the source information.
10198
10299 Returns:
103- -------
104100 Source: A new instance of Source.
105101 """
106102 if "realm" not in json :
@@ -125,12 +121,10 @@ class EvaluateResult:
125121 def from_json (cls , json : dict [str , Any ]) -> "EvaluateResult" :
126122 """Creates an EvaluateResult instance from a dictionary.
127123
128- Parameters:
129- -----------
124+ Args:
130125 json: A dictionary containing the evaluation result.
131126
132127 Returns:
133- -------
134128 EvaluateResult: A new instance of EvaluateResult.
135129 """
136130 if "realm" not in json :
@@ -160,12 +154,10 @@ def __init__(self, channel: str, data: dict, source: Source):
160154 def from_json (cls , json : dict [str , Any ]) -> "ScriptMessage" :
161155 """Creates a ScriptMessage instance from a dictionary.
162156
163- Parameters:
164- -----------
157+ Args:
165158 json: A dictionary containing the script message.
166159
167160 Returns:
168- -------
169161 ScriptMessage: A new instance of ScriptMessage.
170162 """
171163 if "channel" not in json :
@@ -194,12 +186,10 @@ def __init__(self, realm_info: RealmInfo):
194186 def from_json (cls , json : dict [str , Any ]) -> "RealmCreated" :
195187 """Creates a RealmCreated instance from a dictionary.
196188
197- Parameters:
198- -----------
189+ Args:
199190 json: A dictionary containing the realm created event.
200191
201192 Returns:
202- -------
203193 RealmCreated: A new instance of RealmCreated.
204194 """
205195 return cls (realm_info = RealmInfo .from_json (json ))
@@ -217,12 +207,10 @@ def __init__(self, realm: str):
217207 def from_json (cls , json : dict [str , Any ]) -> "RealmDestroyed" :
218208 """Creates a RealmDestroyed instance from a dictionary.
219209
220- Parameters:
221- -----------
210+ Args:
222211 json: A dictionary containing the realm destroyed event.
223212
224213 Returns:
225- -------
226214 RealmDestroyed: A new instance of RealmDestroyed.
227215 """
228216 if "realm" not in json :
@@ -266,39 +254,33 @@ def remove_console_message_handler(self, id):
266254 def pin (self , script : str ) -> str :
267255 """Pins a script to the current browsing context.
268256
269- Parameters:
270- -----------
257+ Args:
271258 script: The script to pin.
272259
273260 Returns:
274- -------
275261 str: The ID of the pinned script.
276262 """
277263 return self ._add_preload_script (script )
278264
279265 def unpin (self , script_id : str ) -> None :
280266 """Unpins a script from the current browsing context.
281267
282- Parameters:
283- -----------
268+ Args:
284269 script_id: The ID of the pinned script to unpin.
285270 """
286271 self ._remove_preload_script (script_id )
287272
288273 def execute (self , script : str , * args ) -> dict :
289274 """Executes a script in the current browsing context.
290275
291- Parameters:
292- -----------
276+ Args:
293277 script: The script function to execute.
294278 *args: Arguments to pass to the script function.
295279
296280 Returns:
297- -------
298281 dict: The result value from the script execution.
299282
300283 Raises:
301- ------
302284 WebDriverException: If the script execution fails.
303285 """
304286
@@ -390,20 +372,17 @@ def _add_preload_script(
390372 ) -> str :
391373 """Adds a preload script.
392374
393- Parameters:
394- -----------
375+ Args:
395376 function_declaration: The function declaration to preload.
396377 arguments: The arguments to pass to the function.
397378 contexts: The browsing context IDs to apply the script to.
398379 user_contexts: The user context IDs to apply the script to.
399380 sandbox: The sandbox name to apply the script to.
400381
401382 Returns:
402- -------
403383 str: The preload script ID.
404384
405385 Raises:
406- ------
407386 ValueError: If both contexts and user_contexts are provided.
408387 """
409388 if contexts is not None and user_contexts is not None :
@@ -426,8 +405,7 @@ def _add_preload_script(
426405 def _remove_preload_script (self , script_id : str ) -> None :
427406 """Removes a preload script.
428407
429- Parameters:
430- -----------
408+ Args:
431409 script_id: The preload script ID to remove.
432410 """
433411 params = {"script" : script_id }
@@ -436,8 +414,7 @@ def _remove_preload_script(self, script_id: str) -> None:
436414 def _disown (self , handles : list [str ], target : dict ) -> None :
437415 """Disowns the given handles.
438416
439- Parameters:
440- -----------
417+ Args:
441418 handles: The handles to disown.
442419 target: The target realm or context.
443420 """
@@ -460,8 +437,7 @@ def _call_function(
460437 ) -> EvaluateResult :
461438 """Calls a provided function with given arguments in a given realm.
462439
463- Parameters:
464- -----------
440+ Args:
465441 function_declaration: The function declaration to call.
466442 await_promise: Whether to await promise resolution.
467443 target: The target realm or context.
@@ -472,7 +448,6 @@ def _call_function(
472448 user_activation: Whether to trigger user activation.
473449
474450 Returns:
475- -------
476451 EvaluateResult: The result of the function call.
477452 """
478453 params = {
@@ -505,8 +480,7 @@ def _evaluate(
505480 ) -> EvaluateResult :
506481 """Evaluates a provided script in a given realm.
507482
508- Parameters:
509- -----------
483+ Args:
510484 expression: The script expression to evaluate.
511485 target: The target realm or context.
512486 await_promise: Whether to await promise resolution.
@@ -515,7 +489,6 @@ def _evaluate(
515489 user_activation: Whether to trigger user activation.
516490
517491 Returns:
518- -------
519492 EvaluateResult: The result of the script evaluation.
520493 """
521494 params = {
@@ -540,13 +513,11 @@ def _get_realms(
540513 ) -> list [RealmInfo ]:
541514 """Returns a list of all realms, optionally filtered.
542515
543- Parameters:
544- -----------
516+ Args:
545517 context: The browsing context ID to filter by.
546518 type: The realm type to filter by.
547519
548520 Returns:
549- -------
550521 List[RealmInfo]: A list of realm information.
551522 """
552523 params = {}
0 commit comments