AXUIElementsForSearchPredicate attribute - Multiple Search keys result into zero query results

Skip to first unread message

Dexter Leng

Apr 21, 2021, 12:26:02 PM4/21/21
to Chromium Accessibility

I am writing my own screen-reader esque software and would like it to work with Chromium. Search Predicates are used by VoiceOver to query for multiple elements in a single AX call for performance reasons. I'm trying to follow that as well.

I noticed that if I pass more than one search key to the AXUIElementsForSearchPredicate parameterized attribute, I get zero elements back.

I can't attach a file here, I've created a pastebin of the Swift Playground code I've created to make it easy to replicate:

1. Open Chrome with a web page
2. Run the code as it (with multiple search keys)
3. 0 should be printed
4. comment out all search keys except for one (e.g. AXLinkSearchKey)
5. run it again, you should a number > 0 printed

If you were to swap the bundle identifier to Safari (, you'll notice that it works fine with multiple search keys.

I'm not sure why this is the case for Chromium.

Dominic Mazzoni

Apr 21, 2021, 12:35:22 PM4/21/21
to Dexter Leng, Chromium Accessibility
Hi Dexter,

I think we may have recently fixed that. When we first added support for AXUIElementsForSearchPredicate, we mistakenly interpreted multiple predicates as "all" rather than "any", and we didn't realize it because VoiceOver typically calls it with just one. We discovered this bug when we realized that Voice Control was calling AXUIElementsForSearchPredicate with multiple predicates and getting nothing.

The fix is in Chrome 91.0.4456.0 and higher. Could you try the dev or canary channel and see if it works for you now?

- Dominic

To unsubscribe from this group and stop receiving emails from it, send an email to
Reply all
Reply to author
0 new messages