1

I am developing a mobile automation software which use appium internally. When i get a page source i receive an xml which contains mobile elements. My requirement is to generate a unique and shortest and relative XPath for each element(node) in the xml. Approches used so far:

  • XSLT transformation - Not 100% Compatible with Appium.

Appreciate any help for the matter.

1

XPath 3.1 has the function path() so //node()/path() will give you the paths of all nodes. However, these are XPath 3.1 paths - they will use the notation Q{uri}local to refer to element and attribute names. Generating path expressions with earlier versions of XPath is difficult because of the namespace problem - there's no way of generating names for namespaced elements that isn't either (a) dependent on the externally-supplied namespace context, or (b) very verbose (*[local-name()='z' and namespace-uri() = 'y'])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.