Using multiple Loadvars to paste data


I have started using Katalon to automate some test scripts on our database.

I have started using the loadvars tag to search for a product in our system - the script successfully makes its way through the list no problem.

What i am trying to do next is for each product I search for I want to paste in a unique piece of text - for example;

search for service 1, paste in XXX
search for service 2, paste in YYY
search for service 3, paste in ZZZ

I have tried using multiple LoadVars however when the script enters the second list it always returns the first value. Can anyone help or direct as to how I might be able to achieve this?

Many thanks


Thank you for sharing your issue. Have you tried to do

with your second list yet? Does it return the second list? If yes, I think the code of pasting has some problems. If no, I think it is the issue of loadVars for execution.

Hello, thanks for coming back. Yes it is returning the second list - but on pasting the values it always returns the first set of date.

With each cycle of the process I am trying to cycle through the values to paste in.



If so, I think we can change our logic while my dev team investigate loadVar.

I found this sample in Chat-GPT to work on your problem:

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

// Load the Test Data
TestData testData = findTestData('TestData')

// Loop through the data rows
for (def row : testData.getAllData()) {
    // Get the product and text values from the current row
    def product = row['Product']
    def text = row['Text']
    // Perform the search with the product value
    WebUI.setText(findTestObject('Page_Object/input_productSearchInput'), product)
    WebUI.sendKeys(findTestObject('Page_Object/input_productSearchInput'), Keys.chord(Keys.ENTER))

    // Wait for the search results to load (add appropriate wait time if needed)
    // Paste the text value into the input field
    WebUI.setText(findTestObject('Page_Object/input_pasteTextInput'), text)
    // Add any validations or further test steps as needed
    // Rest of your test steps for each product goes here