What is an object repository?
Object repository is the place from where Optimus finds the elements and performs the action on these elements according to the test.
Steps to create an object repository
- Under the resources folder of your project, create a new folder and name it elements.
- You can either choose to group your object repositories according to the screen or you could directly store
them with the file name same as the activity name in the case of Android.
- For locating the elements via Appium Inspector, please follow these steps.
- After successfully locating the elements, store them in the object repository as shown above.
How to store elements inside the object repository?
As you can see in the above image, the elements are stored in an object, to be specific, a JSON object.You have to specify the app name that is under test.Inside elements array, you need to store the name of the element, the identifier(xpath,id or class), the value of locator and/or waitFor.
Note : waitFor is optional.You may or may not use it.