あんまりよくない let b = app.buttons.firstMatch // まだマシ let b = app.buttons["Done"].firstMatch // こうするのがベスト let b = app.navigationBars.buttons["Done"].firstMatch // 曖昧さを最大限なくすのが重要 accessibilityIdentifier がなくてもOK WWDC2017 のセッション「What's New in Testing」 より ( 一部変更) 13