code: 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;
      }
docs: 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.
  @link http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/JavascriptExecutor.html#executeScript(java.lang.String,%20java.lang.Object...)
  @param statementPattern javascript to run, possibly with placeholders to be replaced.
  @param parameters placeholder values that should be replaced before executing the script.
  @return return value from statement.