2016-11-08 6 views
0

私のアプリのUIテストを作成しようとしています。私はそれにUITableViewとモーダル表示されたビューコントローラですポップアップがあります。テーブルビューには2つのクリック可能なセルがあり、どちらもビューコントローラを閉じます。問題は、このポップアップが表示され、ビューコントローラとしてではなく要素ツリーに「その他の要素」として表示される場合です。私はotherElements[@"PopOverViewController"]と要素を見つけることができますが、彼らは何であるか分からないので、コントローラ上のセルをクリックすることができません。iOSのUIテスト - 提示されたビューコントローラが「その他の要素」として表示される

→Other 0x7fc778039540: traits: 8589934592, {{32.0, 155.5}, {311.0, 356.0}}, label: 'PopOverViewController' 

この要素にアクセスしてこのビューコントローラのボタンをクリックするにはどうすればよいですか? PopOverViewControllerが

Image 0x7fc26378c270: traits: 8589934596 
    Image 0x7fc263784310: traits: 8589934596, {{0.0, 0.0}, {375.0, 64.0}} 
    Button 0x7fc263786ff0: traits: 8724152321, {{8.0, 26.0}, {110.0, 30.0}}, label: '*****' 
    Button 0x7fc26378d480: traits: 8724152321, {{8.0, 36.5}, {11.0, 11.0}}, label: '*****' 
    StaticText 0x7fc263794620: traits: 8589934656 
    StaticText 0x7fc2637817d0: traits: 8590000192 
    NavigationBar 0x7fc263788140: traits: 35192962023424, {{0.0, 20.0}, {375.0, 44.0}}, identifier: '*****' 
    StaticText 0x7fc263793090: traits: 8589934656, {{146.5, 70.5}, {82.0, 22.0}}, label: '*****' 
    Button 0x7fc26378ea40: traits: 8589934593, {{67.5, 104.5}, {240.0, 35.0}}, label: '*****' 
    StaticText 0x7fc26378de50: traits: 8589934656, {{86.0, 155.5}, {203.5, 38.5}}, label: '*****' 
    Other 0x7fc263795f30: traits: 8589934592, {{67.5, 54.0}, {240.0, 168.0}} 
    Other 0x7fc26379b470: traits: 8589934592 
    Other 0x7fc26379a570: traits: 8589934592, {{0.0, 64.0}, {375.0, 148.0}} 
    Other 0x7fc26378f9c0: traits: 8589934592, {{0.0, 216.0}, {375.0, 407.0}} 
    StaticText 0x7fc26379be90: traits: 8589934656, {{90.0, 232.0}, {53.5, 20.5}}, label: '*****' 
    StaticText 0x7fc26379c4f0: traits: 8589934656, {{90.0, 250.0}, {114.0, 19.5}}, label: '*****' 
    StaticText 0x7fc26379cd60: traits: 8589934656, {{90.0, 289.0}, {57.0, 18.0}}, label: '*****' 
    Cell 0x7fc2637934c0: traits: 8589934592, {{0.0, 216.0}, {375.0, 123.0}} 
    StaticText 0x7fc26379dc10: traits: 8589934656, {{90.0, 355.0}, {52.5, 20.5}}, label: '*****' 
    StaticText 0x7fc26379e330: traits: 8589934656, {{90.0, 373.0}, {98.0, 19.5}}, label: '*****' 
    StaticText 0x7fc26379ea80: traits: 8589934656, {{90.0, 412.0}, {57.0, 18.0}}, label: '*****' 
    Cell 0x7fc26379d490: traits: 8589934592, {{0.0, 339.0}, {375.0, 123.0}} 
    StaticText 0x7fc26379f970: traits: 8589934656, {{90.0, 478.0}, {95.0, 20.5}}, label: '*****' 
    StaticText 0x7fc2637a00b0: traits: 8589934656, {{90.0, 496.0}, {129.5, 19.5}}, label: '*****' 
    StaticText 0x7fc2637a0800: traits: 8589934656, {{90.0, 535.0}, {57.0, 18.0}}, label: '*****' 
    Cell 0x7fc26379f1f0: traits: 8589934592, {{0.0, 462.0}, {375.0, 123.0}} 
    Table 0x7fc2637901b0: traits: 35192962023424, {{0.0, 64.0}, {375.0, 559.0}} 
    Button 0x7fc2637a0ff0: traits: 8589934593, {{0.0, 623.0}, {375.0, 44.0}}, label: '*****' 
    Other 0x7fc2637a1710: traits: 8589934592 
    Other 0x7fc263796ea0: traits: 8589934592, {{0.0, 64.0}, {375.0, 603.0}} 
    Other 0x7fc263799490: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc263791ac0: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc26376a060: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}} 
    Image 0x7fc2637a26a0: traits: 4, {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc2637a2de0: {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc2637a3500: traits: 8589934592, {{32.0, 155.5}, {311.0, 356.0}}, label: 'PopOverViewController' 
    Other 0x7fc2637a1f50: {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc263782e40: {{0.0, 0.0}, {375.0, 667.0}} 
    Window 0x7fc263112950: Main Window, {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc2637a4cc0: traits: 8589934592 
    Other 0x7fc2637a44d0: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}} 
    Window 0x7fc2637a3d50: {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc2637a6340: {{0.0, 0.0}, {375.0, 20.0}} 
    Other 0x7fc2637a7210: traits: 8388608, {{6.0, 0.0}, {39.0, 20.0}} 
    Other 0x7fc2637a7960: traits: 8388608, {{50.0, 0.0}, {13.0, 20.0}}, label: '3 of 3 Wi-Fi bars', value: SSID 
    Other 0x7fc2637a80e0: traits: 8389120, {{165.0, 0.0}, {48.0, 20.0}}, label: '1:29 PM' 
    Other 0x7fc2637a8850: traits: 8388608, {{345.0, 0.0}, {25.0, 20.0}}, label: '-100% battery power' 
    Other 0x7fc2637a6a90: {{0.0, 0.0}, {375.0, 20.0}} 
    StatusBar 0x7fc2637a5bd0: {{0.0, 0.0}, {375.0, 20.0}} 
    Window 0x7fc2637a5450: {{0.0, 0.0}, {375.0, 667.0}} 

を示しているとき

おかげでここ

EDIT

が出力され、私はPopOverViewControllerを見ることができますが、その上にテキストや細胞のいずれも(テキストが空白にされていませんポップオーバービューコントローラー上に表示されているものではなく、プレゼンテーションコントローラからのものです)

EDIT

私は[app.otherElements[@"PopOverViewController"] descendantsMatchingType:XCUIElementTypeAny]を実行した場合、私は出力を参照してください。

Other 0x7fc263795f30: traits: 8589934592, {{67.5, 54.0}, {240.0, 168.0}} 
    Other 0x7fc26379b470: traits: 8589934592 
    Other 0x7fc26379a570: traits: 8589934592, {{0.0, 64.0}, {375.0, 148.0}} 
    Other 0x7fc26378f9c0: traits: 8589934592, {{0.0, 216.0}, {375.0, 407.0}} 
    Other 0x7fc2637a1710: traits: 8589934592 
    Other 0x7fc263796ea0: traits: 8589934592, {{0.0, 64.0}, {375.0, 603.0}} 
    Other 0x7fc263799490: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc263791ac0: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc26376a060: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc2637a2de0: {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc2637a3500: traits: 8589934592, {{32.0, 155.5}, {311.0, 356.0}}, label: 'PopOverViewController' 
    Other 0x7fc2637a1f50: {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc263782e40: {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc2637a4cc0: traits: 8589934592 
    Other 0x7fc2637a44d0: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}} 
    Other 0x7fc2637a6340: {{0.0, 0.0}, {375.0, 20.0}} 
    Other 0x7fc2637a7210: traits: 8388608, {{6.0, 0.0}, {39.0, 20.0}} 
    Other 0x7fc2637a7960: traits: 8388608, {{50.0, 0.0}, {13.0, 20.0}}, label: '3 of 3 Wi-Fi bars', value: SSID 
    Other 0x7fc2637a80e0: traits: 8389120, {{165.0, 0.0}, {48.0, 20.0}}, label: '1:29 PM' 
    Other 0x7fc2637a8850: traits: 8388608, {{345.0, 0.0}, {25.0, 20.0}}, label: '-100% battery power' 
    Other 0x7fc2637a6a90: {{0.0, 0.0}, {375.0, 20.0}} 

おそらく私の提示ビューコントローラかもしれないが、私は、オブジェクトのいずれかが全て」であるそれらに起因しているものを見ることができませんその他 "

答えて

0

セルのコンテンツに直接アクセスしてみてください。

XCUIApplication *app = [[XCUIApplication alloc] init]; 
[app.staticTexts[@"Cell One"] tap]; 
+0

これを試したことがありませんでした。要素インスペクタを見ると、2つのボタンのテキストは画面に表示されても表示されません。私はビューコントローラで何も特別なことはしていませんが、それはカスタムトランジションの非フルスクリーンモーダルです。 – yak

0

通常、コンテナビュー内の要素はアクセスできません。 PopOverViewControllerをアクセス不能にして、セルを使用可能にする必要があります。

self.isAccessibilityElement = false 

ビューコントローラでこれを行い、通常どおりにセルを照会します。

app.cells.elementBoundByIndex(0).tap() 
+0

返事をありがとう。私は役に立たないだけでなくこれを試しました。私はポップアップを表示する前と後に要素ツリーから印刷出力を取り出したが、変化しないので、新しい要素は要素ツリーに表示されません。 – yak

+0

@IanYakHoughtonはポップアップの前と後に 'app.descendantsMatchingType(.Any).debugDescription'の質問に出力を追加できますか? – Oletha

+0

テキストを空白にして元の質問に出力を追加しました。私は 'PopOverViewController'は見ることができますが、それに関連するものは何もありません。 – yak

0

ストーリーボードでアクセシビリティを有効にするためのフラグを削除することで、これを解決することができました。その後、要素インスペクタでセルが表示されました。

関連する問題