MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / script

Method script

py/selenium/webdriver/remote/webdriver.py:1315–1332  ·  view source on GitHub ↗

Pinned scripts, script execution and console, error and DOM-mutation handlers. Returns: The session's ``Script`` object. Examples: `total = driver.script.execute("(a, b) => a + b", 1, 2)` `pinned = driver.script.pin("() => { window.helper = () =>

(self)

Source from the content-addressed store, hash-verified

1313
1314 @property
1315 def script(self) -> Script:
1316 """Pinned scripts, script execution and console, error and DOM-mutation handlers.
1317
1318 Returns:
1319 The session's ``Script`` object.
1320
1321 Examples:
1322 `total = driver.script.execute("(a, b) => a + b", 1, 2)`
1323 `pinned = driver.script.pin("() => { window.helper = () => 42 }")`
1324 `handler_id = driver.script.add_console_handler(messages.append)`
1325 """
1326 if not self._websocket_connection:
1327 self._start_bidi()
1328
1329 if not self._script:
1330 self._script = Script(BidiScript(self._websocket_connection, self), self)
1331
1332 return self._script
1333
1334 def _start_bidi(self) -> None:
1335 if self.caps.get("webSocketUrl"):

Callers

nothing calls this directly

Calls 2

_start_bidiMethod · 0.95
ScriptClass · 0.90

Tested by

no test coverage detected