Skip to main content
May 6, 2026
Question

Id are changing while creating xpaths in Automation testing

  • May 6, 2026
  • 2 replies
  • 0 views

My Team's Automation engineers are trying to automate the testing for the applications. They are using id for input fields to create x paths. The problem when the tab is refreshed, the ID's for the same field is being changed in the html. Can we keep any unique identifier for creating x paths?

    2 replies

    shubhama926776
    May 6, 2026

    Don’t use the changing HTML id for XPath because it is dynamic and can change on refresh.
    Use a stable locator instead, such as label text, name, aria-label, or a partial XPath with contains() / starts-with() if a fixed prefix exists.

    Similar Post - https://community.appian.com/discussions/f/rpa/31005/how-to-use-xpath-as-a-browser-action-selector-which-is-changing-dynamically

    varuntejg243705
    May 6, 2026

    Hi [mention:995c759ada07435883c8572879d4840b:e9ed411860ed4f2ba0265705b8793d05] ,

    We can’t rely on Appian generated HTML IDs, they are dynamic in nature as they are generated at runtime, even we have also faced this.

    Instead, we had done few workarounds,

    1. Use Attributes such as - Labels, Placeholder text, Tooltips.

    2. Using Relative Xpaths instead of Absolute Xpaths.

    3. Use Nearby anchors.

    4. If you are using automation tools like selenium, use predefined functions like getByLabel().

    Note: Try to use unique label names, Placeholder Text, Proper tooltips to help the debugger understand the DOM elements.

    Hope this will solve your issue! Happy to help further!