# How to paramterize xpath object properties and use it inside test case?

**URL:** <https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709>\
**Category:** Miscellaneous\
**Created:** [January 2, 2018, 10:28pm UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709 "2018-01-02T22:28:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ai\_test](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@ai\_test](https://forum.katalon.com/u/ai_test)\
**Post date:** [January 2, 2018, 10:28pm UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709/1 "2018-01-02T22:28:00Z")

</div>

Hello, I am new to Katalon, currently evaluating it; going from RobotFW with Selenium2Library…

Say I need many objects with properties selection method is XPath and my Selector Editor is like below:  
.//td[contains(text(),‘abc1’)]  
…  
.//td[contains(text(),‘xyz100’)]

How can I parameterize the the object properties, so that I can just have 1 object and pass in the search string on the fly, inside the test case? Thanks

---

<div class="post-metadata">

**Author:** ![ai\_test](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@ai\_test](https://forum.katalon.com/u/ai_test)\
**Post date:** [January 3, 2018, 12:38am UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709/2 "2018-01-03T00:38:25Z")

</div>

Below is what I have tried by not working

my xpath object, myobj1, Selector Editor content:  
.//td[contains( text(), [${myStr}] )]

then inside testcase:  
WebUI.click(findTestObject(‘mypage/myobj1’, [(‘myStr’) : ‘abc1’]))

---

<div class="post-metadata">

**Author:** ![Zarashima](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/zarashima/32/928_2.png) [@Zarashima](https://forum.katalon.com/u/Zarashima)\
**Post date:** [January 3, 2018, 1:35am UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709/3 "2018-01-03T01:35:55Z")

</div>

Hi ai test,

You can only use this feature from ‘Basic’ mode. This feature does not available on CSS and Xpath mode, so your case will look like this:  
 ![](https://s3.amazonaws.com/katalon-forum/editor/u6/fb9iki5qkr08.png "Image: https://s3.amazonaws.com/katalon-forum/editor/u6/fb9iki5qkr08.png")

[2018-01-03\_083536.png](https://s3.amazonaws.com/katalon-forum/editor/u6/fb9iki5qkr08.png)

---

<div class="post-metadata">

**Author:** ![ai\_test](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@ai\_test](https://forum.katalon.com/u/ai_test)\
**Post date:** [January 3, 2018, 2:11am UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709/4 "2018-01-03T02:11:59Z")

</div>

Hello Vinh,  
Thank you for the information.  
Now, I have changed my object Selection Method to Basic type and Add the xpath property exactly as you have shown in your image and saved the object, but test is not able to locate object.

Test error, still same as before, when I had Selection Method type XPath:  
Test Cases/tcase1 FAILED because (of) Unable to click on object ‘Object Repository/mypage/myobj1’ Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/mypage/myobj1’ located by ‘By.xpath: .//td[contains( text(),[abc1])]’ not found)

---

<div class="post-metadata">

**Author:** ![Zarashima](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/zarashima/32/928_2.png) [@Zarashima](https://forum.katalon.com/u/Zarashima)\
**Post date:** [January 3, 2018, 2:51am UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709/5 "2018-01-03T02:51:40Z")

</div>

Hi ai test,

That is not the correct xpath. In this case it should be:  
`.//td[contains( text(),"${myStr}" )]`

---

<div class="post-metadata">

**Author:** ![ai\_test](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@ai\_test](https://forum.katalon.com/u/ai_test)\
**Post date:** [January 3, 2018, 6:19pm UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709/6 "2018-01-03T18:19:00Z")

</div>

Awesome, thanks Vinh! that works

---

<div class="post-metadata">

**Author:** ![Jaikumar\_Kesav](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@Jaikumar\_Kesav](https://forum.katalon.com/u/Jaikumar_Kesav)\
**Post date:** [April 30, 2018, 12:30pm UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709/7 "2018-04-30T12:30:45Z")

</div>

am new to this, can you explain ${myStr}, can you give an example code  
how to declare this in manual mode

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [April 30, 2018, 11:59pm UTC](https://forum.katalon.com/t/how-to-paramterize-xpath-object-properties-and-use-it-inside-test-case/8709/8 "2018-04-30T23:59:23Z")

</div>

Jaikumar,

> can you explain ${myStr},

Have a look at the Groovy Language’s String interpolation documentation:

[http://docs.groovy-lang.org/latest/html/documentation/#\_string\_interpolation](http://docs.groovy-lang.org/latest/html/documentation/#%5C_string%5C_interpolation)
