iosobjective-ckif-frameworkkif

how to select UIMenuItem of UIMenuController in KIF framework?


I created UIMenuItem programmingly in Xcode, and using

[deleteItem setAccessibilityLabel:@""];
[deleteItem setIsAccessibilityElement:YES];

to set the access UILabel and make it accessible for testing, however, when I run the test using

[tester tapViewWithAccessibilityLabel:@"menuItemDelete"];

It is failed with error message of component with this access label not found.

Anyone knows how to make a select of UIViewController Items via KIF framework?

Thank you...


Solution

  • I think I found the answer myself, by accessibility inspector in iOS simulator, you are able to find the label for the components.

    So in the accessibility inspector, seems the label is same as UIMenuItem title(seems it is affected by setAccessibilityLabel method in the source code)

    So you can use

    [tester tapViewWithAccessibilityLabel:@"Custom Name"];
    

    to simulate the selection of menu item now enter image description here