Typically when we work with selenium automation of a website, we go with say an element id, which is intuitive, human readable and via a process can be locked down to be shared between developers and automation engineers.
Our current assignment is automation of an Android app (hybrid app using Ionic) with Appium (running on web driver context, not native context).
Things are different here since Ionic generates the HTML on its own from the code and disregards the element ids given by the developers.
So we are left with the only option of using xpath which looks like:
//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/UIAWebView[1]/UIAButton[1] or //html/body/div[5]/div/div/div[1]/div[1]/div[3]/div[1]/div[2]/div[3]/div[2]
(note not written by developers, generated by Ionic).
This makes us uncomfortable for 2 reasons:
Not intuitive like before since we did not write it
Do not have clarity what changes by developers will cause a change in the xpath and break the automation test cases (basically need a system to prevent automation scripts from regressing because of developer code changes).
This brings me to 2 questions:
Is there a better option possible for identifying UI elements in a hybrid app than this
If not, is their an explanation for the two concerns posted above.
Any help will be much appreciated
Thanks