プログラムで UIBarButtonItem を作成し、そのアクセシビリティ識別子とラベルを設定しています。ここに私が使用しているコードがあります。
_rightBarButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40.0f, 40.0f)];
buttonImage = [[UIImage imageNamed:@"bt_send_.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0.0f, 0, 0.0f)];
[_rightBarButton setBackgroundImage:buttonImage forState:UIControlStateNormal];
[_rightBarButton addTarget:self action:@selector(sendQuickNote:) forControlEvents:UIControlEventTouchUpInside];
//Accessibility Identifier for Send Button
_rightBarButton.isAccessibilityElement = YES;
_rightBarButton.accessibilityIdentifier = @"Send Note";
_rightBarButton.accessibilityLabel = @"Send Note";
[_rightBarButton setTitle:@"Send Note" forState:UIControlStateNormal];
self.sendButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_rightBarButton];
self.sendButtonItem.enabled = NO;
//Accessibility Identifier for Send Button
self.sendButtonItem.isAccessibilityElement = YES;
self.sendButtonItem.accessibilityIdentifier = @"Send Note";
self.sendButtonItem.accessibilityLabel = @"Send Note";
[self.sendButtonItem setTitle:@"Send Note"];
[self.navigationItem addRightBarButtonItem:self.sendButtonItem];
ただし、アクセシビリティ識別子は Appium インスペクターでは利用できません。ここで何が間違っていますか?
ありがとう。