# findTestObject with regular expression

**URL:** <https://forum.katalon.com/t/findtestobject-with-regular-expression/10694>\
**Category:** Miscellaneous\
**Created:** [May 4, 2018, 2:15pm UTC](https://forum.katalon.com/t/findtestobject-with-regular-expression/10694 "2018-05-04T14:15:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![klaus\_kleber](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@klaus\_kleber](https://forum.katalon.com/u/klaus_kleber)\
**Post date:** [May 4, 2018, 2:15pm UTC](https://forum.katalon.com/t/findtestobject-with-regular-expression/10694/1 "2018-05-04T14:15:50Z")

</div>

Hi,

I have a problem to find a testObject with following code:  
GlobalVariable.asdf = WebUI.getText(findTestObject(‘Page\_xyz/span\_qwer’))

Error is:  
Unable to get text of object ‘Object Repository/Page\_xyz/span\_qwer’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page\_xyz/span\_qwer’ located by ‘By.xpath: //span[(matches(text(), ‘[0-9]{6}-[0-9]{4}-I[0-9]{5}’) or matches(., ‘[0-9]{6}-[0-9]{4}-I[0-9]{5}’))]’ not found)

My testobject has the condition “matches regex” with the value “[0-9]{6}-[0-9]{4}-I[0-9]{5}”

The Selector Editor shows this (uneditable):  
//span[(matches(text(), ‘[0-9]{6}.[0-9]{4}.I[0-9]{5}’) or matches(., ‘[0-9]{6}.[0-9]{4}.I[0-9]{5}’))]

- Obeject Repository  
- Page\_xyz  
- span\_qwer

What am I doing wrong?  
(of course there is a span with a text like 123456-1234-I12345)

Thanks

---

<div class="post-metadata">

**Author:** ![albert.vu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/albert.vu/32/20595_2.png) [@albert.vu](https://forum.katalon.com/u/albert.vu)\
**Post date:** [August 8, 2022, 7:11am UTC](https://forum.katalon.com/t/findtestobject-with-regular-expression/10694/2 "2022-08-08T07:11:38Z")

</div>

Archived on August 8, 2022, 7:11am UTC


