I was wonder how can I reuse an elements while I’m using appium.
An elementSerarch returns an ID which is generated by Appium , I was wonder if there a way to reuse the same element by it’s id ?
If not , then what is the purpose of the element’s id ?
Thanks
Life cycle of element ID
An element ID/Locator is valid till the time Current Activity in mobile app is not refreshed by any action
Activity in android app is a like DOM we have for webapplication
purpose of the element’s id
Any element which is a part of Activity can be located using id,xpath,className by which element is created etc, once element is located we can perform any action like tap,click,scroll,sendKeys(entering text)
Reuse of element id:
I have never used Page Object pattern framework, so I am not sure but there is annotation to maintain cached elements @CacheLookup. It might help in reusing element but what will be it’s life cycle till what time element will be valid for current locator I am not sure about that…
Thanks for the clear explanation