Home > Back-end >  Xcode 14 , XCUITests - Tap is not working for WebView default done button
Xcode 14 , XCUITests - Tap is not working for WebView default done button

Time:10-07

We have started adopting a new version of Xcode 14, and we see many tests failure. Many test failures are mainly those with a web view inside the app. After trying all the different alternatives, we cannot tap on the done button; that's the default button when we open the web view in the app.

Please list the steps you took to reproduce the issue: Our tests are trying tap on done button that's inside the web view and seeing error (default done button of browsers). We can check the existence of the button that's return true but can't tap on it . see attachment

that's Xcode 14 bug for sure. I also tested previous version of Xcode 13.4.1 and did not see any error

Any alternative way to handle the webview done button

enter image description here

CodePudding user response:

extension XCUIApplication {

    func tapCoordinate(at point: CGPoint) {
         let normalized = coordinate(withNormalizedOffset: .zero)
         let offset = CGVector(dx: point.x, dy: point.y)
         let coordinate = normalized.withOffset(offset)
         coordinate.tap()
     }

}

with help from How to tap on a specific point using Xcode UITests

  • Related