private static String _replaceCommandVars(String token, Element element) throws Exception {

    Matcher matcher = _pattern.matcher(token);

    while (matcher.find() && PoshiRunnerVariablesUtil.containsKeyInExecuteMap(matcher.group(1))) {

      String varName = matcher.group(1);

      String varValue = PoshiRunnerVariablesUtil.getValueFromExecuteMap(varName);

      if ((element.attributeValue("function") != null) && varName.startsWith("locator")) {

        varName = StringUtil.replace(varName, "locator", "locator-key");

        String locatorKey = PoshiRunnerVariablesUtil.getValueFromExecuteMap(varName);

        if (Validator.isNotNull(locatorKey)) {
          StringBuilder sb = new StringBuilder();

          sb.append("<em title=\"");
          sb.append(varValue);
          sb.append("\">");
          sb.append(locatorKey);
          sb.append("</em>");

          varValue = sb.toString();
        }
      }

      token = StringUtil.replace(token, matcher.group(), varValue);
    }

    return token;
  }
  private static String _getSummary(Element element) throws Exception {
    String summary = null;

    if (element.attributeValue("summary") != null) {
      summary = element.attributeValue("summary");
    }

    if (summary == null) {
      if (element.attributeValue("action") != null) {
        summary = PoshiRunnerContext.getActionCommandSummary(element.attributeValue("action"));
      } else if (element.attributeValue("action-summary") != null) {
        summary =
            PoshiRunnerContext.getActionCommandSummary(element.attributeValue("action-summary"));
      } else if (element.attributeValue("function") != null) {
        summary = PoshiRunnerContext.getFunctionCommandSummary(element.attributeValue("function"));
      } else if (element.attributeValue("function-summary") != null) {
        summary =
            PoshiRunnerContext.getFunctionCommandSummary(
                element.attributeValue("function-summary"));
      } else if (element.attributeValue("macro") != null) {
        summary = PoshiRunnerContext.getMacroCommandSummary(element.attributeValue("macro"));
      } else if (element.attributeValue("macro-summary") != null) {
        summary =
            PoshiRunnerContext.getMacroCommandSummary(element.attributeValue("macro-summary"));
      }
    }

    if (summary != null) {
      summary = PoshiRunnerVariablesUtil.replaceCommandVars(summary);

      return _replaceCommandVars(summary, element);
    }

    return null;
  }