xpath and dynamic content

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
c676228
Posts: 176
Joined: Mon Apr 06, 2015 5:40 am

xpath and dynamic content

Post by c676228 » Fri Jan 29, 2016 2:18 am

Hi Folks,

As we all aware that any web pages could have many dynamic ui elements.
What are the best practice to stick with in order to maintain the same xpath when a page transit from one state to another(with different dynamic content)?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: xpath and dynamic content

Post by odklizec » Fri Jan 29, 2016 8:24 am

Hi,

Basically, you should not use indexes in your xpaths. Indexes should be your last resort to identify something. You should use them only if there is really no way to identify an element by using relationship operators, relative paths, etc...

Another thing you should keep in mind is that if the only available identification attribute is for example InnerText and the inner text of given element tends to change, you should not use such attribute as well. Eventually, you should use a regular expression to identify a text within the inner text, which does not change.

More suggestions regarding automating UI with dynamic controls can be found in this blog:
http://www.ranorex.com/blog/automated-t ... ynamic-ids
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration