Note: For Xcode 8 or above, UIAutomation will not work anymore.
First of all, all the environment settings should be done.
Then, download the demo app (TestApp.app) from github: https://github.com/appium/ios-test-app, and build it into your simulator using Xcode. Find the TestApp.app file in the folder (the path will be used as the capability “app” for iOS).
Next, enter the capabilities into Appium and start the session.
For the elements that have same locator values, e.g. accessibility id, we can create a list and then locate to a particular element. Note that the elements of the list starts from 0: the first element is the 0th one, then the second element is the 1st one, the third is the 2nd one:
IList <AppiumWebElement> AppElemList = driver.FindElementsById(“AppElem“);
//Then I want to select the second element of this ID: