[SOLVED] Native XCUITest selection strategy

Hi all,

Is there any word of a native XCUITest selector strategy, to replace the not-intended-for-XCUITest XPath strategy, and the now-obsolete ios_uiautomation (python naming) strategy?

If not I would be interested in working towards contributing this new selector strategy as it would be very useful to me, and hopefully to other people.

I did not find it being discussed on github yet.

If there is currently nobody working on it, could anyone here point me towards some resources on how to go about implementing it? Is there anyone else with experience who would be willing to help towards this goal?

Kind Regards,
Emil R. Petersen

Me too. I did lot’s of research and got few docs regarding Nspredicate for Appium. eg. https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios_predicate.md only one example for nspredicate. How can I locate cells or statictexts on the iOS app? How can I get particular elements using nspredicate?

Thank you very much in advance.

Hey Richard, thanks for making me aware of the iOS predicates. It seems that while tests were added for the python-appium driver, the documentation was not updated.

I don’t know if you’re using Python, but either way, have you tried a strategy like this? https://github.com/appium/python-client/blob/master/test/functional/ios/find_by_ios_predicate_tests.py

I’m thinking particularly the last example there, which may (I have yet to test this selection strategy) allow you to select by type and then the value of certain fields.

Take my advice with a grain of salt since your comment taught me this exists, and I haven’t tried it yet. :slight_smile: Good luck.

Turns out that the python-driver documentation was not updated, and that this has been added since the move to XCUITest!

Using (python syntax) find_element(s)_by_ios_predicate works perfectly, and is a great replacement for UIAutomation and XPath on XCUITest-supported devices. I have now tested it myself and been very happy with the results.

Cheers to the Appium team for their timely and awesome adding of support of XCUITest!

How can it be used in findBy annotations (java)? Should we use @iOSFindBy(uiAutomator = "isWDVisible == 1") ?

1 Like

You could try these links:
XCUITModeTest demo code:

Java-client 5.0BETA1 Page-objects documentation:

I am trying to implement these to my legacy code which using iOS predicate but not iOS predicate String. There are lots of headaches. Furthermore, I am not sure how to locate multiple layers elements same like iOS predicate “.tableViews()[0].cells()[1]…”.

Gook luck!