[Mobile] Get Text


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/mobile-get-text.html
1 Like

Is that possible to setText into an EditText than get the value through this? I am getting an error like ‘object not found.’ :frowning:

1 Like

Use getAttribute method and the object of the getAttribute that you have to give in the parameter need to save in the object repository.

The below example worked for me.

Mobile.setText(findTestObject(‘android.widget.EditText0 - hhhhhhhhhhhhh (1)’), ‘shamim’, 0)
String text= Mobile.getAttribute(findTestObject(‘android.widget.EditText0 - shamim’), ‘text’, 5) Mobile.verifyEqual(text, ‘shamim’) Mobile.closeApplication()

1 Like

how can i know the code if i want to get label text on the button in the list view element?

1 Like

How can I validate the “Get Text” function inside of .groovy file (Keywords file) I am seeing “groovy.lang.MissingPropertyException: No such property” exception, please go through with below example

Example:
public class abc {
@Keyword
public void sample(){
txt = Mobile.getText(findTestObject(‘ObjectLoc’), 0)
Mobile.verifyMatch(txt, ‘actualTxt’, false)
}
}

1 Like