Katalon Mobile Testing - SetText FREEZE issue

Hello team Katalon,

I am new in katalon

I am trying to set a text on the textbox with integer type and when I run it, it keep freezing and it does not get an error. Here is my code
Mobile.setText(findTestObject(‘VitalSign/VitalSign_tab/temperature_editText’), String.valueOf(‘10’), 0)

Attached file is my object reposiroty

Thank You,
Heaven Leih

Hi @heavenmojica,

KS did not freeze, but it was trying to find your object that means your object location may not correct.

Please check at the xpath property only and execute again. If the execution is failed, please send us the execution log (copy the Console log then send us in text file).

Thanks.

1 Like

Not 100% sure but may be useful checking what object is identifiable by, I have found it easier in some scenarios to enable class/attribute etc and use these to correctly and reliably identify an element.

1 Like

I checked the xpath property only and execute again. The execution is not failed but the execution on the setText did not continued. Here are the screenshots of log viewer and console log
Console Log —


Log Viewer —

Thank You,
Heaven

I tried also to enabled the class and instance and this is the result

Hi @heavenmojica,

I’ve often had more luck with the Mobile.sendKeys() function instead of setText(). Note that when using sendKeys, it’s expected that the text field is focused, so you’ll need to perform the tap action on the field first.

https://docs.katalon.com/katalon-studio/docs/mobile-send-keys.html

If that doesn’t work, it might be worth checking what Katalon and Appium think are on the screen at the time you’re trying to set your text. If you want to see some more detail about exactly what Appium/Katalon detects on the screen you can log out the XML contents of the screen. You should be able to do that by putting the following import statements at the top of your test case:

import com.kms.katalon.core.logging.KeywordLogger
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.AppiumDriver

Then in the code for your test, add the following right before you set the text:

AppiumDriver<?> driver = MobileDriverFactory.getDriver()
KeywordLogger log = new KeywordLogger()
log.logInfo(driver.getPageSource())

When the test runs, you should see an entry in the Log Viewer for “Statement - log.logInfo(driver.getPageSource())” that shows the start of the XML for the screen. If you tap on it, you’ll see all of the XML for the screen on the right-hand pane.

If you could attach that XML in a reply that would be helpful for troubleshooting.

Hope this helps,

Chris

1 Like

Change the 0 at the end to 3 or something relatively small otherwise it will not time out or take a very long time to time out and not fail the execution, this way you can be sure which step it is failing on.

Not sure on how to resolve the issue with send text, possibly have a step before to ensure that it is clicking inside the expected text field first.

1 Like

Thanks sir @adam.cane sir @Chris_Trevarthen sir @duyluong for your response. Everything is OK now I tried all your solution and it’s working. I appreciated it a lot :slight_smile:

Here is my question again :slight_smile:

When I switch to another phone, this simple script is working
Mobile.setText(findTestObject(‘VitalSign/VitalSign_tab/respiration_editText’), ‘12’, 0)

What is the problem on the other phone that is not working? the Xpath of that textbox is also correct

Thank You

1 Like

tried inspecting and saving the object? Then compare side by side; maybe some very small difference.

2 Likes

Hi @heavenmojica,

What are the 2 devices you’re testing on (manufacturer, model, and OS version)? Which works and which does not?

That info could help us troubleshoot some more.

Thanks,

Chris

Yes sir maybe it saves different object. Thank You sir @adam.cane

Hello sir @Chris_Trevarthen

WORKING DEVICE
manufacturer: NOKIA 3
model: TA-1032
OS version: 7.1.1

NOT WORKING
manufacturer: OPPO
model: CPH1819
OS version: 8.1.0

Hi @heavenmojica,

Other than the different Android versions, the other major difference I see in the phones is that the Nokia has hardware menu buttons where the Oppo has software buttons. I’m not sure that this should impact the ability to use Appium or Katalon Studio, but it’s obviously causing different behavior.

If you’d like to dig further, you could try logging out the screen contents per my previous post to see if Appium detects different objects on the screen depending on which phone you’re using.

As I mentioned, I usually use Mobile.sendKeys() now instead of Mobile.setText() because of inconsistencies with setText. Note that for sendKeys to work, I think you will need to make sure the keyboard is already open by having your test tap on the text field first.

Hope this helps,

Chris

1 Like