I want to get data from a group of elements on the site (they are not a list) and save it in array. I could call them all through xpath : (//div[contains(@class,‘loan-title ng-star-inserted’)])
but I always getting error :
groovy.lang.MissingMethodException: No signature of method: com.kms.katalon.core.webui.driver.SmartWaitWebDriver.findElements() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject) values: [TestObject - ‘Object Repository/Pages/CleanUp/loansDetailsList’]
Possible solutions: findElements(org.openqa.selenium.By), findElement(org.openqa.selenium.By)
test case :
// To locate the list of the selector
WebDriver driver = DriverFactory.getWebDriver()
WebUI.waitForElementPresent(findTestObject(‘Pages/CleanUp/firstLoanDetails’), 5)
List loansList = driver.findElements(findTestObject(‘Object Repository/Pages/CleanUp/loansDetailsList’))
//To loacate the list size
int loansListCount = loansList.size()
CustomKeywords.‘sample.Login.ExtarctLoanIDandSaveInArray’(loansListCount, loansList)
Custom keyword :
@Keyword
//####### extract the loan id from dashboard loan’s list & save them in array ######
public static String ExtarctLoanIDandSaveInArray(int countSize,List list,List loansID) {
for (int r = 0; r < countSize; r++) {
def loanItem = list.get(r).split(‘SM’)[1]
//def loansDetailsList = t.split(‘SM’)[1]
def loansDetailsList1= loanItem.split(’-’)[0]
loansID.add(list(r))
WebUI.comment(loansDetailsList1)