UISearchBar cancel button

347 views
Skip to first unread message

Quico Moya

unread,
Mar 11, 2014, 3:26:59 AM3/11/14
to kif-fr...@googlegroups.com
Hi there,

I can't figure out how to simulate the pressing of a UISearchBar's cancel button. The UIButton is unreachable from the published interface, and thus its accessibility label can't be set.

Has anyone had the same problem and eventually found an elegant solution?

Thanks!

Bhuvana K

unread,
Mar 12, 2014, 2:45:35 AM3/12/14
to kif-fr...@googlegroups.com

This below fix worked for me.

searchBar.isAccessibilityElement=YES;

searchBar.accessibilityLabel=@"Cancel";


In the test method:

[tester tapViewWithAccessibilityLabel:@"Cancel"];


Let me know if it works.

Thanks,

Bhuvaneshwari KN

Vinod Reddy

unread,
Apr 15, 2016, 10:29:38 AM4/15/16
to KIF iOS Automated Testing Framework
it worked.....nice
Reply all
Reply to author
Forward
0 new messages