Accessibility IDs showing up in Accessibility Inspector, but automated testing script is unable to find them

In the app I'm working on, I have a SwiftUI View embedded in a UIKit Storyboard. The SwiftUI View holds a menu with a list of payment tools, and the ForEach loop looks like this:

ForEach(self.paymentToolsVM.paymentToolsItems, id: \.self) { paymentTool in
Button {
navigationCallback(paymentTool.segueID)
} label: {
PaymentToolsRow(paymentToolName: paymentTool.title, imageName: paymentTool.imageName)
.accessibilityElement()
.accessibilityIdentifier("Billing_\(paymentTool.title.replacingOccurrences(of: " ", with: ""))")
}
if paymentTool != self.paymentToolsVM.paymentToolsItems.last {
Divider()
}
}

So you can see the accessibility ID is there, and it shows up properly when I open up Accessibility Inspector with the simulator, but the testing script isn't picking up on it, and it doesn't show up when the view is inspected in Appium. I have other SwiftUI views embedded in the UIKit view, and the script picks up the buttons on those, so I'm not sure what's different about this one.

If it helps, the script is written in Java with the BDD framework. I can try to get the relevant part of the script if anyone thinks that would be helpful. Otherwise, is there anything else I can try?

Hello, it sounds like the script uses a third party testing framework. I would recommend following up with the developers of this framework since it may be an issue with the framework itself. You could also try using the standard XCTest framework to see if you can access this view using the identifier.

Accessibility IDs showing up in Accessibility Inspector, but automated testing script is unable to find them
 
 
Q