It cannot be just a few lines since you really have a lot of different objects. What we can do is to just minimize the repeating ‘taps’ and ‘sendkeys’. I don’t have an exp in mobile testing but I think the code will be almost the same as automating web that’s why I have this idea. . .
try this one out… I hope you find this simple and easy for you to understand…
/**
first, declare all your objects. When you try to print it, it will give you a string output in the console like this:
TestObject - 'VitalSign/VitalSign_tab/temperature_editText'
which is why it is not working because it includes the 'TestObject - ' keyword instead of just passing the whole testobject path. When calling the test object we need to eliminate the extra keyword to get the exact testobject path.
**/
//since it will just return a string output, just remove the 'findTestObject' keyword to eliminate the 'TestObject - '
String input1 = 'VitalSign/VitalSign_tab/temperature_editText'
String input2 = 'VitalSign/VitalSign_tab/pulseHeartRate_editText'
String input3 = 'VitalSign/VitalSign_tab/bpRightArm1_editText'
//I'm not quite familiar with groovy so let's do it in java.
//create a java list then put all your objects in the list.
java.util.List<String> testObjectContainer = [input1, input2, input3]
int input = 10
//do your loop
for (int index = 0; index < testObjectContainer.size(); index++)
{
//this is where the 'findTestObject' will take place
WebUI.verifyElementPresent(findTestObject(testObjectContainer[index]), 5)
Mobile.tap(findTestObject(testObjectContainer[index]))
Mobile.sendKeys(findTestObject(testObjectContainer[index]), input + index)
}
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to verify object 'Object Repository/VitalSign/VitalSign_tab/temperature_editText' is present
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)