Group Group Group Group Group Group Group Group Group

XCUITest with WKWebViews

Hi team! I’ve been working on XCUITest cases loading a web page (Angular, CSS, JS) to the WKWebView.

The test case is very simple, click to the button and open a popup.

I run it last November the test case and it worked perfect on iOS 13.0.
Few weeks ago I run the same test cases with iOS 13.0 and iOS 13.4.1 and I can’t open the popup.

My question is, there is a good way to work with the components inside the web view?

I tried with this lines of code and also recording the taps on the simulators.

XCUIApplication().webViews.webViews.textViews.buttons[" "].tap() //recorded on simulator

let tabButton = app.webViews.buttons.firstMatch
    
if tabButton.exists {
    tabButton.tap()
}

I’m not sure if something happened with the web view or with the CSS styles on the web page.

If the element in wkwebviw like this.

your link text
Then the test code is below

app.links[“your link text”].tap()