I am writing automated tests for mobile application in Java using Appium. I talked with developers to create AccessibilityIds for elements and in Android it works as intended with set String but in iOS AccessibilityId contains additional characters. For example, I have TextField Name - in Android AccessibilityId is txtName, but in iOS it is Name txtName.
That is why I think I need to use contains. With XPath I would write
driver.findElement(By.xpath("//*[contains(@name, 'txtName')]"));
But XPath is relatively slow. How can I do that using AccessibilityId? Rough example of what I'm looking for
driver.findElementByAccessibilityId(/*HERE 'CONTAINS' W\ 'txtName'*/);
It is really important for me to use same solution that works on both Android and iOS. I prefer AccessibilityId because code is easier to understand and fast