[英]How I can resolve this error in Katalon Groovy:unexpected token: do // Groovy:unexpected token: if // Groovy:expecting EOF, found 'if'
// 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;
}
}
Katalon Studio 使用版本 Groovy,在回答這個問題時,它不支持 do-while 循環。
為此,您必須執行此問題中概述的操作。
我花時間在這里鏈接答案,而不是投票結束問題,因為它已經被另一個問題回答了,這是一種專業的禮貌。
歡迎來到 StackOverflow。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.