code: private static void appendLocatorXPath(StringBuilder builder, String locatorName, WebLocator locator, boolean compact) {
          String path = locator.getXPath();
          String xpathLocatorVar = "xpath_" + locatorName;
          String newLine = compact ? "" : "\n";
          builder.append("var ").append(xpathLocatorVar).append("Path = \"").append(path).append("\";").append(newLine);
          builder.append("var ").append(xpathLocatorVar).append(" = $x(").append(xpathLocatorVar).append("Path);").append(newLine);
          builder.append("if (").append(xpathLocatorVar).append("[0]) {").append(newLine);
          builder.append("  console.info('").append(locatorName).append("', ").append(xpathLocatorVar).append("[0]);").append(newLine);
          builder.append("  if (").append(xpathLocatorVar).append(".length > 1) console.warn('  found more elements', ").append(xpathLocatorVar).append(");").append(newLine);
          builder.append("} else {").append(newLine);
          builder.append("  console.error('").append(locatorName).append("', ' - not found!');").append(newLine);
          builder.append("  console.warn(\"  \"+").append(xpathLocatorVar).append("Path);").append(newLine);
          builder.append("}").append(newLine).append(newLine);
      }
docs: TODO add in anonymous function and simplify var names