# Handle get partial text and use it on other input element

**URL:** <https://forum.katalon.com/t/handle-get-partial-text-and-use-it-on-other-input-element/30466>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [July 30, 2019, 9:37am UTC](https://forum.katalon.com/t/handle-get-partial-text-and-use-it-on-other-input-element/30466 "2019-07-30T09:37:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre\_Halim](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/andre_halim/32/3432_2.png) [@Andre\_Halim](https://forum.katalon.com/u/Andre_Halim)\
**Post date:** [July 30, 2019, 9:37am UTC](https://forum.katalon.com/t/handle-get-partial-text-and-use-it-on-other-input-element/30466/1 "2019-07-30T09:37:25Z")

</div>

Let say I have some element with text “Your queue number is 12345”

How do I get only the “12345”, and use it to input in other menu?

I have tried method substring on custom keyword and it doesn’t work

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [July 30, 2019, 9:45am UTC](https://forum.katalon.com/t/handle-get-partial-text-and-use-it-on-other-input-element/30466/2 "2019-07-30T09:45:23Z")

</div>

Hello,

is your text always the same? I mean only that ID is variable. If so. you can do this:

```
String myText = "Your queue number is 12345"
String myId = myText.split("Your queue number is ")[1]

WebUI.setText(yourTestObject, myId)
```

---

<div class="post-metadata">

**Author:** ![Andre\_Halim](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/andre_halim/32/3432_2.png) [@Andre\_Halim](https://forum.katalon.com/u/Andre_Halim)\
**Post date:** [July 30, 2019, 11:06am UTC](https://forum.katalon.com/t/handle-get-partial-text-and-use-it-on-other-input-element/30466/3 "2019-07-30T11:06:45Z")

</div>

This is my code for custom keyword

String str = WebUI.getText(findTestObject(object)).trim()

String result = trim.split("Your queue number is ")[1]

return result

But when I do this, I get error

com.kms.katalon.core.exception.StepErrorException: Error = groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject) values: [TestObject - ‘object’’]  
Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map)

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [July 30, 2019, 11:07am UTC](https://forum.katalon.com/t/handle-get-partial-text-and-use-it-on-other-input-element/30466/4 "2019-07-30T11:07:53Z")

</div>

> [@Andre\_Halim](#):
>
> String str = WebUI.getText(findTestObject(object)).trim()

Do this instead.

`String str = WebUI.getText(object).trim()`

---

<div class="post-metadata">

**Author:** ![Andre\_Halim](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/andre_halim/32/3432_2.png) [@Andre\_Halim](https://forum.katalon.com/u/Andre_Halim)\
**Post date:** [July 30, 2019, 11:20am UTC](https://forum.katalon.com/t/handle-get-partial-text-and-use-it-on-other-input-element/30466/5 "2019-07-30T11:20:44Z")

</div>

thanks it works now
