Accessibility element not found on iOS

Hey Team. I have a react-native application in which I use accessibiltyID-s (testIDs) to locate elements for E2E tests with Appium. Unfortunately there are some elements which is not found by Appium when I run my app on iOS simulator. It works fine with Android emulators. I am using Appium desktop 1.18.3 on Mac

I have debugged the screen hiararchy in Xcode and found that it is marked correctly as accessibility element and has accessibilityID = board_notes_action_button.


It is also found by the Xcode accessibility inspector, so I wonder why it’s not found by appium.

I have attached the page_souce.xml for your convenience.canvas_xml_source.txt (38.4 KB)

Strangely enough… I have buttons on the top of the app (home icon) which are identical, but are not so deep in the layer which are found well.

During the search I have found this article but I’m not sure if it’s related. Cannot find element
(I think that accessibility element has to be found no matter where it’s located)

see https://github.com/appium/appium-xcuitest-driver#settings-api
play with snapshotMaxDepth. increase it.

I tried it with “snapshotMaxDepth”:100 and even 1000 but did not help unfortunately.

1 does size of page source increases when we increase snapshot size?
2 try blindly predicate:

 driver.findElement(MobileBy.iOSNsPredicateString("name == 'your_element_id'"))

Hey Aleksei, I tried you suggestions…but no success

1- a)changed to 10 → 52 lines in page-source.xml
b)changed to 20 → 122 lines
c)changed to 50 → 282 lines
d)changed to 100 → 282 lines

2- I’m using typescript so I executed the command from postman

POST session/2003b375-65f4-4d3f-891f-72de5f444fa1/elements
{
“using”: “-ios predicate string”,
“value”: “name == ‘open_menu_btn’”
}
RESPONSE
{
“value”: ,
“sessionId”: “2003b375-65f4-4d3f-891f-72de5f444fa1”,
“status”: 0
}

That specific element is not found Even If I execute :

{
“using”: “-ios predicate string”,
“value”: “accessible == true”
}

I think I have something very similar to https://github.com/appium/appium/issues/13005
when I execute
POST http://localhost:4723/wd/hub/session/$sessionid/execute
{ "script": "mobile: source", "args": "new Dictionary<string, string> { { \"format\", \"description\" } }" }
I don’t get the element back.

But I do when I use Xcode debugger and exec in lldb
po [[UIWindow keyWindow] recursiveDescription]