[UIAlertView alertViewWithTitle:@"" message:@"Submit successfully!" cancelBlock:^(NSInteger buttonIndex) {
} dismissBlock:nil cancelButtonTitle:@"OK" otherButtonsTitles:nil, nil];
This is the UIAlertView
declaration. However, I desire to UI test cancelButton
.
[tester tapViewWithAccessibilityLabel:@"cancelButton"];
How should I add accessibility to that cancelButton?
You should be able to dismiss the alert by triggering a tap of the cancel button. You can identify the cancel button by its label, which is "OK" in your case.