Check if some parent of that element has an ID or has some specific type.
For example your “XCUIElementTypeOther”, has parent “XCUIElementTypeOther” with ID = “others_parent” - in this case you can do:
driver.findElement(By.id(“others_parent”).findElement(By.ClassName(“XCUIElementTypeOther”));
or if it has a specific type you can do:
driver.findElement(By.className(“XCUIElementTypeTable”).findElement(By.ClassName(“XCUIElementTypeOther”));
When you have a lot of elements on a screen with the same type, it takes a lot of resources to find a specific element (which makes sense) and is also very unsafe (in case your screen is dynamic and some other element get in between, then your element will not be on index = 31). Let the developers assign ID to that element, that would be a perfect scenario.
Maybe you can post a screenshot of hierarchy tree and we can have a look what is possible to do.