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

Method pin_script

py/selenium/webdriver/remote/webdriver.py:603–619  ·  view source on GitHub ↗

Store a JavaScript script by a unique hashable ID for later execution. .. deprecated:: Use ``driver.script.pin()`` instead. Example: `script = "return document.getElementById('foo').value"`

(self, script: str, script_key=None)

Source from the content-addressed store, hash-verified

601 return self.execute(Command.GET_TITLE).get("value", "")
602
603 def pin_script(self, script: str, script_key=None) -> ScriptKey:
604 """Store a JavaScript script by a unique hashable ID for later execution.
605
606 .. deprecated::
607 Use ``driver.script.pin()`` instead.
608
609 Example:
610 `script = "return document.getElementById('foo').value"`
611 """
612 warnings.warn(
613 "pin_script is deprecated, use driver.script.pin() instead",
614 DeprecationWarning,
615 stacklevel=2,
616 )
617 script_key_instance = ScriptKey(script_key)
618 self.pinned_scripts[script_key_instance.id] = script
619 return script_key_instance
620
621 def unpin(self, script_key: ScriptKey) -> None:
622 """Remove a pinned script from storage.

Calls 2

ScriptKeyClass · 0.90
warnMethod · 0.45