2017-08-10 5 views
0

一部のUIオートメーションを実行するためにXCUITestを使用していました。 私はページ上のセルのコレクションを持っている、と私はあることを理解NSPredicateを使用してXCUITestのセル内を検索する

Output: { 
     Cell 0x6080003603c0: traits: 8589934592, {{162.9, 184.6}, {916.5, 83.6}}, label: 'reminder same title, description, 4.38 pm' 
     Cell 0x618000179380: traits: 8589934592, {{162.9, 268.2}, {916.5, 10.9}} 
     Cell 0x608000360300: traits: 8589934592, {{162.9, 279.1}, {916.5, 83.6}}, label: 'reminder same title, description different, 11.37 am' 
     Cell 0x618000179440: traits: 8589934592, {{162.9, 362.7}, {916.5, 10.9}} 
     Cell 0x600000363a80: traits: 8589934592, {{162.9, 373.6}, {916.5, 83.6}}, label: 'reminder same title, other description, 11.03 am' 
     Cell 0x608000360180: traits: 8589934592, {{162.9, 457.2}, {916.5, 10.9}} 
     Cell 0x618000179500: traits: 8589934592, {{162.9, 468.0}, {916.5, 83.6}}, label: 'name A, second, 11.00 am' 
     Cell 0x618000179740: traits: 8589934592, {{162.9, 551.7}, {916.5, 10.9}} 
     Cell 0x610000177580: traits: 8589934592, {{162.9, 562.5}, {916.5, 83.6}}, label: 'name A, first, 11.00 am' 
     Cell 0x600000363000: traits: 8589934592, {{162.9, 646.1}, {916.5, 10.9}} 
     Cell 0x618000179d40: traits: 8589934592, {{409.4, 362.2}, {293.2, 27.1}} 
     Cell 0x600000364800: traits: 8589934592, {{409.4, 389.3}, {293.2, 27.1}} 

po app.cells 

リターンでブレークポイントと入力の設定ラベル

が含まれているものを返すようにしたいです簡単な方法は、ラベルを持つセルに関連付けられたアクセシビリティ識別子を持つことですが、Cellコレクションを調べ、ラベルを含むセルのみを返すために、NSPredicateクエリを構造化する方法はわかりません。

答えて

0

これはあなたのそのラベルのすべてのセルを与える必要は皆無

let predicate = NSPredicate(format: "label != nil") 
let cells = XCUIApplication().cells.matching(predicate) 
ではありません
関連する問題