# Customizing xpath generation

**URL:** <https://forum.katalon.com/t/customizing-xpath-generation/15801>\
**Category:** Web Testing\
**Tags:** web-testing, katalon-studio\
**Created:** [December 20, 2018, 12:36pm UTC](https://forum.katalon.com/t/customizing-xpath-generation/15801 "2018-12-20T12:36:29Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [December 20, 2018, 12:53pm UTC](https://forum.katalon.com/t/customizing-xpath-generation/15801/5 "2018-12-20T12:53:32Z")

</div>

Write a Groovy code which creates a Test Object on the fly.

It will read an existing Test Object with xpath `//button[@id=‘staticId1:dynamicId:staticId2’]/span`

It will translate the xpath into another one like `//button[starts-with(@id,'staticId1') and ends-with(@id,'staticId2')]/span`

Then it will create a new Test Object using the generated xpath.

XPath2.0 `ends-with()` function is not available to us. But alternative (very verbose) xpath expression can do the same query

Let me work out for a few days for developing a solution.

---

_[View the full topic](https://forum.katalon.com/t/customizing-xpath-generation/15801)._
