Accessing more granular level of details in iOS Tests

Hi! I have some questions regarding the way the Smart Recorder sees the components in the mobile application. I had created several tests on Android, and the components are more at granular level than iOS which I just tried out today. If there is the case that I would like to access, for instance, only texts on the top left of this object (Dividend Factor [Managed Risks]) or the percentage on the right, is there any way I can do it?

Thank you in advance!

Hi @SupawisT ,

Appium’s primary support for automating iOS apps is via the XCUITest driver.
This driver leverages Apple’s XCUITest libraries under the hood in order to facilitate the automation of your app, this access to XCUITest is mediated by the WebDriverAgent server.
WebDriverAgent (also referred to as “WDA”) is a project managed by Facebook, to which the Appium core team contributes heavily.
WDA is a WebDriver-compatible server that runs in the context of an iOS simulator or device and exposes the XCUITest API.
Appium’s XCUITest driver manages WDA as a subprocess opaque to the Appium user, proxies commands to/from WDA, and provides a host of additional functionality (like simulator management and other methods).

The elements that are visible in the recorder are the elements that the XCUITest found.
If you want more granular elements you will have to check with your dev team why the specific elements do not communicate with the XCUITest framework and build the framework on these components.
If you for example trying to tap at some point on the screen and you see that some elements do not recognised by XCUITest you can use this solution:

  • You might need to tap an element in a specific location ( iOS), you can use the Tap element at relative point action.

    You can hover the wrapper element of the element you want to tap on, double shift to capture it, and select the “Tap at relative point” action, by providing the Horizontal tap percentage and the Vertical tap percentage (notice: it starts from the top-left corner of the element) you will be able to tap on a specific point on the wrapper element.

Here you can read more about it and find an example:

If you have anymore questions, please feel free to ask :slight_smile:

Oh it worked for me thanks! By the way, while I’m trying to get the texts from the chunk of texts extracted from it, I need to use substrings quite often. But I don’t know how to use addition to index in, let’s say, “get substring in range” command without going to “Evaluate math expression” method. How can I add numbers without going out to evaluate math expression separately?

From the image, I’m trying to add the begin index by 3, but would result in something like “7 +3” instead of getting 10.