private String getFinalJS(JSTemplate template) {
String reference = getRequest().hasVariable(":reference") ? getRequest().getVariableValue(":reference")
: ":reference";
WebDriverLikeCommand command = getRequest().getGenericCommand();
CommandMapping mapping = CommandMapping.get(command);
String jsMethod = mapping.jsMethod(getRequest().getPayload());
String sessionId = getRequest().getSession();
return template.generate(sessionId, reference, jsMethod);
}