public static void runFunctionExecuteElement(Element executeElement) throws Exception { if (_functionExecuteElement == null) { _functionExecuteElement = executeElement; } PoshiRunnerStackTraceUtil.setCurrentElement(executeElement); List<Element> executeVarElements = executeElement.elements("var"); for (Element executeVarElement : executeVarElements) { runVarElement(executeVarElement, false, false); } PoshiRunnerStackTraceUtil.setCurrentElement(executeElement); String classCommandName = executeElement.attributeValue("function"); String className = classCommandName; if (classCommandName.contains("#")) { className = PoshiRunnerGetterUtil.getClassNameFromClassCommandName(classCommandName); } Exception exception = null; int locatorCount = PoshiRunnerContext.getFunctionLocatorCount(className); for (int i = 0; i < locatorCount; i++) { String locator = executeElement.attributeValue("locator" + (i + 1)); if (locator == null) { locator = PoshiRunnerVariablesUtil.getValueFromCommandMap("locator" + (i + 1)); } if (locator != null) { Matcher matcher = _locatorKeyPattern.matcher(locator); if (matcher.find() && !locator.contains("/")) { String pathClassName = PoshiRunnerGetterUtil.getClassNameFromClassCommandName(locator); String locatorKey = PoshiRunnerVariablesUtil.replaceCommandVars( PoshiRunnerGetterUtil.getCommandNameFromClassCommandName(locator)); PoshiRunnerVariablesUtil.putIntoExecuteMap("locator-key" + (i + 1), locatorKey); try { locator = PoshiRunnerContext.getPathLocator(pathClassName + "#" + locatorKey); } catch (Exception e) { exception = e; } locator = PoshiRunnerVariablesUtil.replaceExecuteVars(locator); } PoshiRunnerVariablesUtil.putIntoExecuteMap("locator" + (i + 1), locator); } String value = executeElement.attributeValue("value" + (i + 1)); if (value == null) { value = PoshiRunnerVariablesUtil.getValueFromCommandMap("value" + (i + 1)); } if (value != null) { PoshiRunnerVariablesUtil.putIntoExecuteMap("value" + (i + 1), value); } } SummaryLoggerHandler.startSummary(executeElement); CommandLoggerHandler.startCommand(executeElement); PoshiRunnerStackTraceUtil.pushStackTrace(executeElement); Element commandElement = PoshiRunnerContext.getFunctionCommandElement(classCommandName); try { if (exception != null) { throw exception; } runFunctionCommandElement(classCommandName, commandElement); } catch (Throwable t) { String warningMessage = _getWarningFromThrowable(t); if (warningMessage != null) { _functionWarningMessage = warningMessage; } else { PoshiRunnerStackTraceUtil.popStackTrace(); if (_functionExecuteElement == executeElement) { PoshiRunnerStackTraceUtil.setCurrentElement(executeElement); SummaryLoggerHandler.failSummary(_functionExecuteElement, t.getMessage()); CommandLoggerHandler.failCommand(_functionExecuteElement); _functionExecuteElement = null; _functionWarningMessage = null; } throw t; } } PoshiRunnerStackTraceUtil.popStackTrace(); PoshiRunnerStackTraceUtil.setCurrentElement(executeElement); if (_functionExecuteElement == executeElement) { if (_functionWarningMessage != null) { SummaryLoggerHandler.warnSummary(_functionExecuteElement, _functionWarningMessage); CommandLoggerHandler.warnCommand(_functionExecuteElement); } else { SummaryLoggerHandler.passSummary(executeElement); CommandLoggerHandler.passCommand(executeElement); } _functionExecuteElement = null; _functionWarningMessage = null; } }