0

xcode 7 ベータ版で UI テストを試しています。

XCUIElement が閉じられた後も、その.existsプロパティは YES のままです。

例えば

XCUIElement *button = app.sheets[@"Sample sheet"].buttons[@"Sample button"];
[button tap]; // Tapping will dismiss UIActionSheet and its button will no longer exist.
XCTAssertFalse(button.exists); // -> Error here.

破棄された後に存在しない XCUIElement を検出する方法はありますか?

4

3 に答える 3

2

XCUIElement には、BOOL を返す exists メソッドがあります。

あなたのコードで:

if (button.exists) {
   [button tap];
}
于 2016-01-29T21:02:42.460 に答える
0

app.sheets.count を確認できます

于 2015-10-07T11:01:11.653 に答える