Handling XPath Duplicate Issues

Modified on Wed, 14 Aug at 1:06 PM

Issue: Test execution failures occur when the same control/UI element  names are assigned to different actions. During application profiling, this practice results in creation of duplicate XPaths in the Object repositoryprevents the initiation of the test execution process.

Resolution:
Best Practice: Always provide unique names to each Control/UI element during the application profiling process to avoid duplicate XPaths. Note: Duplicate XPaths can still appear if the same XPath is used in different pages. It’s good to understand how this might impact your Object repository.
Example:
Consider usage of 'Submit' button in Login page and Dashboard page.
XPath Visibility is explained in the following example:
  • On the Login Page: The XPath (//button[@id='submit']) will be associated with the Submit Button control used for login.
  • On the Dashboard Page: The same XPath (//button[@id='submit'] will be associated with the Submit Button control for the dashboard.
Page-Specific Display:
  • Login Page: The XPath for the login control will only appear in the context of the Login Page.
  • Dashboard Page: The XPath for the dashboard control will only appear in the context of the Dashboard Page.
This approach ensures that each XPath is associated with the correct page, avoiding duplication issues during test execution. 



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article