Id are changing while creating xpaths in Automation testing

Certified Associate Developer

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?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi  ,

    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!

Reply
  • 0
    Certified Senior Developer

    Hi  ,

    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!

Children
No Data