# Identifying X paths

**URL:** <https://forums.pega.com/t/identifying-x-paths/10818>\
**Category:** General\
**Tags:** pega-customer-service-for-insurance, testing-applications, pega-platform\
**Created:** [February 26, 2026, 7:53pm UTC](https://forums.pega.com/t/identifying-x-paths/10818 "2026-02-26T19:53:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Edara](https://avatars.discourse-cdn.com/v4/letter/r/49beb7/32.png) [@Rahul\_Edara](https://forums.pega.com/u/Rahul_Edara)\
**Post date:** [February 26, 2026, 7:53pm UTC](https://forums.pega.com/t/identifying-x-paths/10818/1 "2026-02-26T19:53:09Z")

</div>

Can anyone suggest an efficient way to capture or determine the XPath of elements on a page when working with Selenium or mabl? The elements already have a unique test identifier.

 ![image](https://pega1.discourse-cdn.com/pega/original/3X/4/2/42e325395dac746d8000d24fe6518a6f6f522935.png)

---

<div class="post-metadata">

**Author:** ![RameshSangili](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/rameshsangili/32/23377_2.png) [@RameshSangili](https://forums.pega.com/u/RameshSangili)\
**Post date:** [February 26, 2026, 9:10pm UTC](https://forums.pega.com/t/identifying-x-paths/10818/2 "2026-02-26T21:10:47Z")

</div>

> [@Rahul\_Edara](#):
>
> Can anyone suggest an efficient way to capture or determine the XPath of elements on a page when working with Selenium or mabl? The elements already have a unique test identifier.

As a best practice, you must create unique _data-test-ids_ for all UI components that you want to record as part of the flow. Applications that are created post 8.1 version of your Pega application using out-of-the-box components have the unique _data-test-ids_ generated by default.

---

<div class="post-metadata">

**Author:** ![Bas\_van\_Opstal](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/bas_van_opstal/32/15316_2.png) [@Bas\_van\_Opstal](https://forums.pega.com/u/Bas_van_Opstal)\
**Post date:** [April 3, 2026, 8:41am UTC](https://forums.pega.com/t/identifying-x-paths/10818/3 "2026-04-03T08:41:45Z")

</div>

As Ramesh said, unique data-test-ids are the way to identify UI components. And you created that via the Test ID in the screenshot. If you want to identify the element via XPath, you can use

_//\*[@data-testid=“{putyourTestIDhere}”]_

So replace {putyourTestIDhere} with 201411…

If your project uses the constellation architecture, it could be that you need to add widget specific identifiers in the locator, like :combo-box:, or use the contains function of Xpath:

//\*[contains(@data-testid, "_{putyourTestIDhere}_”)]

Additionally, if you would use Playwright for UI testing, it has a built-in locator strategy for _data-testid_.
