2017-10-24 7 views
0

EarlGreyの初心者です。私はそれらを使用する前に、私は迅速に使用しました。さて、私はwhileループを持っている私の問題です、私はEarlGreyでwhileループを作る方法がわかりません。SwiftのEarlGreyの/ Whileループ

私はEarlGreyで書かれたこのwhileループたい:

if XCUIApplication().otherElements[XYZ].exists { while !XCUIApplication().buttons[Button].exists { 
XCUIApplication().otherElements[XYZ].swipeLeft() } 
XCTAssertTrue(XCUIApplication().buttons[Button].exists, "Button not exist!") XCUIApplication().buttons[Button].tap() 
} 

おかげでたくさん!

+0

あなたは基本的にはスワイプしますか残っている限り二つのボタンが表示されているよう? –

+0

はい、ボタンが存在するかどうかを確認する必要があります。 – Saintz

答えて

0

existAccessibilityID(AccessibilityIdentifier: "XYZ")であれば{ EarlGrey.select(elementWithMatcher:grey_accessibilityID(ボタン))。usingSearch(grey_swipeFastInDirection(GREYDirection.left)、onElementWith:grey_accessibilityID(PageViewController))。((grey_tapを行います)) }

[OK]を、私は...解決策を発見した