can't interact with xcuielements inside a wkwebview

Originator:pjotal
Number:rdar://36788196 Date Originated:January 23 2018
Status:Open Resolved:
Product:XCode Product Version:9.2 (9C40b)
Classification: Reproducible:Always
 
Summary: 
it was noticed that even though the xcuielements are displayed in a debugprint, we're not able to interact with them (e.g. fetch label, tap, verify existence, etc). instead, it generates the following errors:

1) in the case of waiting for element to exist:
"Assertion failure in -[XCElementSnapshot replaceDescendant:withElement:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/XCTest_Sim/XCTest-13192.1/Sources/XCTAutomationSupport/UITesting/XCElementSnapshot.m:1534"

2) in the case of trying to interact with the element:
"failed: caught "NSInternalInconsistencyException", "Invalid parameter not satisfying: [descendant _isDescendantOfElement:self]""

Steps to Reproduce:
1. import the project attached and run the ui tests.

Expected Results:
1.1. developer is able to interact with xcuielements inside webviews
1.2. all ui tests in this project pass

Actual Results:
1.1. errors are displayed
1.2. all ui tests in this project fail with the errors described in the summary

Version/Build:
- XCode 9.2 (9C40b)
- iPhone 8 Plus simulator with iOS 11.1

Configuration:
N/A

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!