public Object executeJavascript ( String statementPattern , Object ... parameters ) { Object result ; String script = String . format ( statementPattern , parameters ) ; if ( statementPattern . contains ( "arguments" ) ) { result = executeScript ( script , parameters ) ; } else { result = executeScript ( script ) ; } return result ; }
Executes Javascript in browser . If statementPattern contains the magic variable arguments the parameters will also be passed to the statement . In the latter case the parameters must be a number a boolean a String WebElement or a List of any combination of the above .