I need to test submitting a form and want to change the username each time I fill out a new form. I trying to use the variable in my for loop to make the username unique, but the script keeps failing. Here is my code snippet
I’m attempting to populate number 1 in Last Name field for the first iteration, 2 in second loop iteration and so on. Any help with this is much appreciated, looked through the forum and videos online but I’m stuck here. Thanks for reading !!!
Oh, this is the error when I run this script :
Test Cases/Signup/Individual - Copy FAILED because (of) (Stack trace: groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.Integer) values: [TestObject - ‘Object Repository/SignUP/input_Last Name_individual-las’, …]
Hi @Nilau, thanks for your help earlier ! I’m now trying to submit a form and select a country from a drop down list. There are 200+ countries in the dropdown so I exported them to a test data file and created a for loop for 200 iterations. I’m trying to reference the test data file using the for loop variable but that doesn’t seem to work. Any ideas !?
What your actual test case workflow/intended behavior ?
I think it should be something like this :
for ( int i = 1; i < 200; i++) {
WebUI.openBrowser ("")
WebUI.navigateToUrl ('https://paradigm-fe5ghyt.webflow.io/request-access')
WebUI.selectOptionByValue (findTestObject*(‘SignUP/select_country’), findTestData (‘SignUP’).getValue(1, i), false )
}
You don’t need the “toString()” here. You only need this when you have an object you want to change to a text (String) format. GetValue() take two integers (numbers) as parameters.
Thanks for the response !
My testcase is to submit a form with name and country fields. I want to test submission works for all countries in the dropdown, so I need to create 200+ submissions. I exported the list of countries to a test data file and thought I’d reference the test data file in my script. I got this to work using this code, open to optimization ideas