HomeiOS Developmentios - Anticipate web page to load utterly and content material grow...

ios – Anticipate web page to load utterly and content material grow to be seen. XCUI Appliction


for i in 1......1000{
    sleep(5)
    makeScreenshot(identify:  "Web page-(i)")
    app.swipeLeft()
}

as an alternative of sleep i wish to implement dynamic wait that waits for web page to load utterly and content material on every web page turns into seen earlier than taking screenshot.

I attempted utilizing XCUIApplication().waitForExcistence(timeout: 10) but it surely did not work as anticipated it took screenshot earlier than content material grow to be seen for some pages.

I additionally tried this Perform from chatGpt but it surely did not work as anticipated it took screenshot earlier than content material grow to be seen for some pages.

func waitForAppQuiescence(timeout: TimeInterval) { 
    let quiescenceExpectation = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists ==                              true"), object: XCUIApplication()) 
    let outcome XCTWaiter().wait(for: [quiescenceExpectation], timeout: timeout) 
    if outcome =  .accomplished { 
        print("Timed out ready for the app to grow to be quiescent")
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments