UI オートメーションを使用して iPhone アプリをテストします。「追加」ボタンがタップできません。これを機能させるために有効にする必要があるものは他にありますか?
エラー: スクリプトがキャッチされていない JavaScript エラーをスローしました: target.frontMostApp().toolbar().buttons()[0] をタップできませんでした。Elements トレースにボタンが表示されます。
自動化スクリプト:
var toolbar = UIATarget.localTarget().frontMostApp().toolbar();
toolbar.buttons()[0].tap();
toolbar.buttons()["Add"].tap();
(上記の両方の行を試しました)
Xcode:
- (void)configureToolbarItems {
UIBarButtonItem *addButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self action:@selector(addNewTaskButtonPressed)];
addButtonItem.accessibilityLabel=@"Add";
(some other buttons here...)
[self setToolbarItems:[NSArray arrayWithObjects:
addButtonItem,flexibleSpace, helpBarButton, flexibleSpace, shoppingBarButton, nil] animated:YES];
}