Execute-Script

Execute-Script [-script] [-args] [-sessionId ] []

Powershell

Syntax

syntaxItem

{@{name=Execute-Script; CommonParameters=True; parameter=System.Object[]}}

Parameters

name description
args
script
sessionId

C#

Declaration

OpenQA.Selenium.IJavaScriptExecutor::object ExecuteScript(string script, params object[] args);

Arguments:

type name description
System.String script The JavaScript code to execute.
object[] args The arguments to the script.

Returns:

type description
System.Object The value returned by the script.

Examples

string title = (string)driver.Keyboard.ExecuteScript("return document.title");