# Katalon Mobile Testing - SetText FREEZE issue

**URL:** <https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572>\
**Category:** Mobile Testing\
**Tags:** mobile-testing, katalon-studio\
**Created:** [April 22, 2019, 4:16am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572 "2019-04-22T04:16:09Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![heavenmojica](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heavenmojica/32/1408_2.png) [@heavenmojica](https://forum.katalon.com/u/heavenmojica)\
**Post date:** [April 22, 2019, 4:16am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/1 "2019-04-22T04:16:09Z")

</div>

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

 ![object](https://europe1.discourse-cdn.com/katalon/original/2X/9/987f3ae3110fef592ce7dd9295251e93f36da5c9.png)

Thank You,  
Heaven Leih

---

<div class="post-metadata">

**Author:** ![duyluong](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/duyluong/32/1116_2.png) [@duyluong](https://forum.katalon.com/u/duyluong)\
**Post date:** [April 23, 2019, 10:29am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/2 "2019-04-23T10:29:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adam.cane](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/adam.cane/32/4160_2.png) [@adam.cane](https://forum.katalon.com/u/adam.cane)\
**Post date:** [April 23, 2019, 2:47pm UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/3 "2019-04-23T14:47:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![heavenmojica](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heavenmojica/32/1408_2.png) [@heavenmojica](https://forum.katalon.com/u/heavenmojica)\
**Post date:** [April 24, 2019, 12:38am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/4 "2019-04-24T00:38:48Z")

</div>

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 —

 ![consolelog](https://europe1.discourse-cdn.com/katalon/original/2X/e/e347c5bbbf253256c6e33024a0ea37fd94026ee7.png)  
Log Viewer —  
 ![logs001](https://europe1.discourse-cdn.com/katalon/original/2X/1/18655bc9418c9571edd445ca89881aaf550c03f8.png)

Thank You,  
Heaven

---

<div class="post-metadata">

**Author:** ![heavenmojica](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heavenmojica/32/1408_2.png) [@heavenmojica](https://forum.katalon.com/u/heavenmojica)\
**Post date:** [April 24, 2019, 12:44am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/5 "2019-04-24T00:44:59Z")

</div>

> [@adam.cane](#):
>
> 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.

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

> [@heavenmojica](#):
>
> 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 —
> 
> [![consolelog](https://europe1.discourse-cdn.com/katalon/uploads/default/uploads/default/original/2X/e/e347c5bbbf253256c6e33024a0ea37fd94026ee7.png)  
> consolelog.PNG1154x240 27.4 KB  
> ](https://europe1.discourse-cdn.com/katalon/uploads/default/uploads/default/original/2X/e/e347c5bbbf253256c6e33024a0ea37fd94026ee7.png)
> 
> Log Viewer —
> 
> [![logs001](https://europe1.discourse-cdn.com/katalon/uploads/default/uploads/default/original/2X/1/18655bc9418c9571edd445ca89881aaf550c03f8.png)](https://europe1.discourse-cdn.com/katalon/uploads/default/uploads/default/original/2X/1/18655bc9418c9571edd445ca89881aaf550c03f8.png)

---

<div class="post-metadata">

**Author:** ![Chris\_Trevarthen](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/chris_trevarthen/32/358_2.png) [@Chris\_Trevarthen](https://forum.katalon.com/u/Chris_Trevarthen)\
**Post date:** [April 24, 2019, 2:19am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/6 "2019-04-24T02:19:47Z")

</div>

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](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:

```auto
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:

```auto
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

---

<div class="post-metadata">

**Author:** ![adam.cane](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/adam.cane/32/4160_2.png) [@adam.cane](https://forum.katalon.com/u/adam.cane)\
**Post date:** [April 24, 2019, 7:57am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/7 "2019-04-24T07:57:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![heavenmojica](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heavenmojica/32/1408_2.png) [@heavenmojica](https://forum.katalon.com/u/heavenmojica)\
**Post date:** [April 25, 2019, 3:30am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/8 "2019-04-25T03:30:53Z")

</div>

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 🙂

Here is my question again 🙂

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

---

<div class="post-metadata">

**Author:** ![adam.cane](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/adam.cane/32/4160_2.png) [@adam.cane](https://forum.katalon.com/u/adam.cane)\
**Post date:** [April 25, 2019, 8:12am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/9 "2019-04-25T08:12:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chris\_Trevarthen](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/chris_trevarthen/32/358_2.png) [@Chris\_Trevarthen](https://forum.katalon.com/u/Chris_Trevarthen)\
**Post date:** [April 25, 2019, 1:29pm UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/10 "2019-04-25T13:29:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![heavenmojica](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heavenmojica/32/1408_2.png) [@heavenmojica](https://forum.katalon.com/u/heavenmojica)\
**Post date:** [April 26, 2019, 1:02am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/11 "2019-04-26T01:02:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![heavenmojica](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heavenmojica/32/1408_2.png) [@heavenmojica](https://forum.katalon.com/u/heavenmojica)\
**Post date:** [April 26, 2019, 1:10am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/12 "2019-04-26T01:10:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chris\_Trevarthen](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/chris_trevarthen/32/358_2.png) [@Chris\_Trevarthen](https://forum.katalon.com/u/Chris_Trevarthen)\
**Post date:** [April 26, 2019, 3:16am UTC](https://forum.katalon.com/t/katalon-mobile-testing-settext-freeze-issue/23572/13 "2019-04-26T03:16:03Z")

</div>

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
