Dear Leif,

Actually, this specific topic has been asked by real developers who need to 
automatically generate XPath from a specific element inside the tree.

As you mentioned, the two main goals are:
    - Shortness: because the xpath can be overwhelmingly long (two lines in one 
of the examples).
    - Unlikeness to be changed later (but this is almost impossible to be 
automatically calculated).

Another implicit goal is:
    - Easiness to read xpath expression by human and find it in the html.

I would vote that having xpath expression with/without @class/index number is 
irrelevant, as it won't matter much.

Regarding the ID, that is guaranteed to be unique and easy searchable, and can 
be used in the automated calculation, but it is not always available.


Hope that helps,
Ahmed

PS: As a side note, if you would like to participate with the logic, we are 
more than happy to include it.


      

Reply via email to