execute_async_script
The command to execute async javascript into the browser.
script = "var callback = arguments[arguments.length - 1]; " \
"window.setTimeout(function(){ callback('timeout') }, 3000);"
driver.execute_async_script(script)Syntax
py.execute_async_script(javascript: str) -> Any
py.execute_async_script(javascript: str, *args) -> AnyUsage
# Yields the value of document.title
py.execute_async_script("return document.title;")
---or---
# Yields the .innerText of the element with the id of 'foo'
py.execute_async_script("return document.getElementById(arguments[0]).innerText", "foo")# Errors, 'execute_script' yields a WebElement, not a Pylenium Element
py.execute_async_script("return document.getElementById(arguments[0])").get()Arguments
Yields
Examples
Last updated