How to use for Loop in List of elements

Hello I have a problem about my project in katalon. Hope you can help me. This is my problem. I want this step to be inside the for loop. it is possible? Since the actions are all the same.!Thanks in advance
I want to check that the following function is available in www.siacargo.com:
Track Shipment - clicking on this can open a new page, with the following fields available:
‘Air Waybill 1’ – Text box with default value “618” followed by empty text box.
‘Air Waybill 2’ – Text box with default value “618” followed by empty text box.
‘Air Waybill 3’ – Text box with default value “618” followed by empty text box.
‘Air Waybill 4’ – Text box with default value “618” followed by empty text box.
‘Air Waybill 5’ – Text box with default value “618” followed by empty text box.

Hi @soclabador,

After clicking the “Tack shipment” do you need to verify this list using for loop?

Can you describe it step by step?

Thanks!

Hi @Arnel,

Yes, it is I need to verify the elements using for loop.

Hello @Arnel
What I want is, for the first loop. I will verify the ‘Air Waybill 1’, followed by the Text box with default value ‘618’ and followed by empty text box.

And then for the second loop, i will be able to verify the ‘Air Waybill 2’, followed by textbox with default value ‘618’ and followed by empty text box. And so on. :slightly_smiling_face:

Hi @soclabador,

Do exactly what I did here… It works on on my side.

Make sure the “Detect Object By?” is checked when you configure you test object.

Hope that helps. . . :slight_smile:

1 Like

Hello @Arnel.

I tried it on my end, but I have this error. Also, I checked the “Detect Object By?”

This is the full error message.
=============== ROOT CAUSE =====================

================================================

07-03-2020 12:09:21 PM Test Cases/SiaTest

Elapsed time: 19.209s

Test Cases/SiaTest FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: Script1593748238199.findTestObjects() is applicable for argument types: (java.lang.String, java.util.LinkedHashMap) values: [_AirwayBill, [num:1]]
at SiaTest.run(SiaTest:25)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1593749359113.run(TempTestCase1593749359113.groovy:25)

@soclabador,

can you attach your code here? Thanks!

1 Like

@soclabador,

Line 25, 26, 27, it is findTestObject not findTestObjects. Look at my code again…

And on line 26, you have ‘\’ at the end of the line. Remove it. It might cause another error.

Oh!, my bad. Im so sorry. It works. Thanks a lot @Arnel for noticing my problem an taking time to help me. :slight_smile:

You’re welcome. Glad I helped. :smiley:

Cheers! :beers:

1 Like