Page 1 of 1

xpath and dynamic content

Posted: Fri Jan 29, 2016 2:18 am
by c676228
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)?

Re: xpath and dynamic content

Posted: Fri Jan 29, 2016 8:24 am
by odklizec
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