Reputation: 239
Can anyone tell me how to extract label/value/name of any button or navigator bar
code I have tried so far
NSString *Test = app.navigationBars[@"Test"].staticTexts[@"Test"].title;
NSLog(@"%@++++++++", Test);
and
NSString *Test = app.navigationBars[@"Test"].staticTexts[@"Test"].accessibilityLabel;
NSLog(@"%@++++++++", Test);
and
NSString *Test = app.navigationBars[@"Test"].staticTexts[@"Test"].accessibilityValue;
NSLog(@"%@++++++++", Test);
Output remains null for all the 3 above
Upvotes: 0
Views: 191
Reputation: 2419
You will have to use label
. For your case replace this as :
NSString *Test = app.navigationBars[@"Test"].staticTexts[@"Test"].label;
Upvotes: 1
Reputation: 7659
Use label
to access the value of a static text element.
NSString *test = app.navigationBars[@"Test"].staticTexts[@"Test"].label;
NSLog(@"%@++++++++", test);
https://developer.apple.com/reference/xctest/xcuielementattributes/1500692-label
Upvotes: 1