Forum Discussion
For dynamic web pages like yours, it really helps to get familiar with the page’s HTML DOM and understand how element attributes change. TestComplete’s Object Spy and Object Browser are great tools, but I usually use the browser’s Developer Tools (F12) or Inspect Element to copy the full XPath before and after a page change — that makes it easy to also see which parts of the path are dynamic.
Try to avoid using dynamic values wherever possible. When you can’t, use wildcards or regular expressions in your Name Mapping, or with the FindChild() and FindAllChildren() methods.
One effective approach is to anchor your XPath to a stable ancestor element and use the contains() function. For example:
/html/body/div[3]/div[2]/div[5]/span[@id='textnode17']
can be rewritten as:
//div[@class='content-panel']//span[contains(@id, 'textnode')]
By referencing a stable ancestor and using partial matching, your test objects remain more resilient to changes in dynamic identifiers.
🤖 AI-assisted response
👍 Found it helpful? Click Like
✅ Issue resolved? Click Mark as Solution