Mobile object parameterization doesn't appear to work in some cases

Hi all,
I’m trying to follow the documentation here to parameterize my mobile objects. Ultimately I’d like to pass values from the feature files. But for now trying to see if this will be possible to do on a broader scale of objects and keywords.

This seems to work great with the following:

Mobile.verifyElementText(findTestObject('Object Repository/android.widget.TextView_PageTitle', ['text' : 'Home']), 'Home')

But when trying the “tap” keyword, parameterization doesn’t appear to be working as I’d expect:

Mobile.tap(findTestObject('Object Repository/android.widget.TextView_PageTitle', ['text' : 'Home']), 3)

I’ve checked the “Detect Objects by” box on the “text” field. It defaults to the text that’s written under the “Value” field instead.

Am I missing something?

Hi @Aleks,

From looking at the documentation, the important part is to edit the Test Object to check the “Detect Objects by” box for text, but also make sure you set the value of that property to ${text}. That way, Katalon knows to insert the value you specify during your test, e.g. Home.

I’d leave everything else except class unchecked. So my Test Object looks like:

1 Like

@Chris_Trevarthen Thanks for the reply. I did exactly as you’ve detailed in your response, before posting the question, the only difference I noticed just now is that my ${text} in the value field was encased in “”, which seems to be the culprit of my troubles :smiley:. Its working now, thank you!

1 Like

${text} variable is mandatory to define under Profile? I would like to define local (in the keywords), how can I do? Thanks

Not sure I’m fully understanding what you mean exactly. I define the variable in the script itself, right on the line where I reference it. No need to do it under Profile as global variable.