0
// Read data from XML file
public static String getElementTextByTagName(String tagName) {
    try {
        String dirPath = System.getProperty('user.dir') + "\\DataFiles\\TestData.xml"
        List<File> xmlFiles = getXMLFilesByDirectory(dirPath);
        Iterator var3 = xmlFiles.iterator();

        XMLSearchResult searchResult;
        do {
            if (!var3.hasNext()) {
                throw new ElementNotFoundInXMLException("Element Not Found");
            }

            File xmlFile = (File)var3.next();
            searchResult = searchForElementInsideFile(xmlFile, tagName);
        } while(!searchResult.isFound());

        return searchResult.getElementText();
    } catch (ElementNotFoundInXMLException var6) {
        var6.printStackTrace();
        return null;
    }
}

enter image description here

  • The error is appearing on the do statement line and below the same for if statement
tim_yates
  • 167,322
  • 27
  • 342
  • 338

1 Answers1

1

Katalon Studio uses a version of Groovy, at the time of this answer, that does not support do-while loops.

For that effect, you'll have to do something like what's outlined in this question.

Consider it a professional courtesy that I take the time to link the answer here, instead of voting to close the question because it's already answered by that other question.

Welcome to StackOverflow.

Mike Warren
  • 3,796
  • 5
  • 47
  • 99