iOS 13.3 XCUITest can no longer enumerate UIKit controls inside a WKWebView

Originator:eric.schramm
Number:rdar://7493918 Date Originated:12/14/2019
Status:Submitted Resolved:
Product:WebKit, iOS Product Version:13.3
Classification: Reproducible:
 
1) Create a simple iOS app that displays a WKWebView and load html that draws an input box and a button, for example.
2) Create an XCUITest that attempts to type test in the text field and push the button
3) Run the test in simulator against the previous iOS release (e.g., 13.2.2) - test passes
4) Run the test in simulator against the latest iOS release (e.g., 13.3) - test fails

It appears by querying in the debugger via `po app` that UI elements that used to be visible to the XCTUITest are no longer visible.

I’ve attached a bare-bones example Xcode project to illustrate. I first noticed my tests failing upon updating Xcode to 11.3. When I run Xcode 11.2.1 which uses a simulator with the earlier version, the tests pass.

In the `po app` output, notice that the TextField and Button are visible in iOS 13.2.2, but not 13.3.

Here is `po app` output in 11.2.2:
(lldb) po app
    t =    16.33s Requesting snapshot of accessibility hierarchy for app with pid 52998
    t =    16.70s Requesting snapshot of accessibility hierarchy for app with pid 52998
Attributes: Application, pid: 52998, label: 'WebViewElementsRegression'
Element subtree:
 →Application, 0x600000386920, pid: 52998, label: 'WebViewElementsRegression'
    Window (Main), 0x600000386840, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x600000386760, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x600000386680, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x6000003865a0, {{0.0, 0.0}, {414.0, 896.0}}
            WebView, 0x6000003864c0, {{0.0, 0.0}, {414.0, 896.0}}
              WebView, 0x6000003863e0, {{0.0, 0.0}, {414.0, 896.0}}
                WebView, 0x600000386300, {{0.0, 0.0}, {414.0, 896.0}}
                  RemotePlaceholder, 0x600000386220, pid: 52998, {{0.0, 0.0}, {414.0, 896.0}}
                    Other, 0x600000386140, {{0.0, 0.0}, {414.0, 896.0}}
                      Other, 0x60000039c1c0, {{0.0, 44.0}, {175.0, 379.0}}
                        Other, 0x6000003880e0, {{0.0, 44.0}, {415.0, 818.0}}
                          Other, 0x6000003881c0, {{122.0, 44.0}, {170.0, 9.0}}
                            StaticText, 0x600000394380, {{173.0, 44.0}, {68.0, 9.0}}, label: 'Web View Step Example', value: Web View Step Exam...
                          Other, 0x6000003882a0, {{122.0, 52.0}, {170.0, 55.0}}
                            TextField, 0x600000388380, {{122.0, 56.0}, {170.0, 19.0}}, value: 
                            Button, 0x600000386060, {{177.0, 87.0}, {60.0, 19.0}}, label: 'Continue'
                Other, 0x600000385f80, {{381.0, 34.5}, {30.0, 826.5}}, label: 'Vertical scroll bar, 1 page', value: 0%
                Other, 0x600000385ea0, {{35.0, 863.0}, {344.0, 30.0}}, label: 'Horizontal scroll bar, 1 page', value: 0%
    Window, 0x600000385dc0, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x600000385ce0, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x600000385c00, {{0.0, 0.0}, {414.0, 896.0}}
Path to element:
 →Application, 0x600000386920, pid: 52998, label: 'WebViewElementsRegression'
Query chain:
 →Find: Target Application 'com.careevolution.WebViewElementsRegression'
  Output: {
    Application, pid: 52998, label: 'WebViewElementsRegression'
  }

Here is `po app` output in 11.3:
(lldb) po app
    t =     7.80s Requesting snapshot of accessibility hierarchy for app with pid 53270
    t =    12.84s Requesting snapshot of accessibility hierarchy for app with pid 53270
Attributes: Application, pid: 53270, label: 'WebViewElementsRegression'
Element subtree:
 →Application, 0x6000016e87e0, pid: 53270, label: 'WebViewElementsRegression'
    Window (Main), 0x6000016e8700, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x6000016e8620, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x6000016e8380, {{0.0, 0.0}, {414.0, 896.0}}
          Other, 0x6000016ebd40, {{0.0, 0.0}, {414.0, 896.0}}
            WebView, 0x6000016ebc60, {{0.0, 0.0}, {414.0, 896.0}}
              WebView, 0x6000016ebb80, {{0.0, 0.0}, {414.0, 896.0}}
                WebView, 0x6000016ebaa0, {{0.0, 0.0}, {414.0, 896.0}}
                Other, 0x6000016eb9c0, {{381.0, 34.5}, {30.0, 826.5}}, label: 'Vertical scroll bar, 1 page', value: 0%
                Other, 0x6000016eb8e0, {{35.0, 863.0}, {344.0, 30.0}}, label: 'Horizontal scroll bar, 1 page', value: 0%
    Window, 0x6000016eb800, {{0.0, 0.0}, {414.0, 896.0}}
      Other, 0x6000016eb720, {{0.0, 0.0}, {414.0, 896.0}}
        Other, 0x6000016eb640, {{0.0, 0.0}, {414.0, 896.0}}
Path to element:
 →Application, 0x6000016e87e0, pid: 53270, label: 'WebViewElementsRegression'
Query chain:
 →Find: Target Application 'com.careevolution.WebViewElementsRegression'
  Output: {
    Application, pid: 53270, label: 'WebViewElementsRegression'
  }

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!