I ran into the same trouble. My workaround:
Place a breakpoint in your UI test that will be hit when the file picker is in the foreground.
Sample test:
func testBlah() {
let app = XCUIApplication()
// The next 2 lines interact with my app to cause it to pop up the file picker.
// These will be different for your app :)
app.navigationBars["Dashboard"].buttons["download"].tap()
app.staticTexts["Browse"].tap()
sleep(3) // Can place breakpoint here for example
}
Once you've hit the breakpoint, view the hierarchy of views by typing po app
(replacing app
with the name of your XCUIApplication
object) into the right pane of the debugger:
(lldb) po app
t = 193.67s Snapshot accessibility hierarchy for app with pid 941
t = 194.22s Snapshot accessibility hierarchy for app with pid 941
Attributes: Application, pid: 941, label: 'Redacted'
Element subtree:
→Application, 0x2814fdea0, pid: 941, label: 'Redacted'
Window (Main), 0x2814fe4c0, {{0.0, 0.0}, {375.0, 667.0}}
Other, 0x2814fe3e0, {{0.0, 0.0}, {375.0, 667.0}}
snip
Cell, 0x2814f42a0, {{257.0, 131.0}, {90.0, 175.0}}, identifier: 'Waterfall Loop Trail, xml', label: 'Waterfall Loop Trail, xml, 9/16/19, 42 KB'
Cell, 0x2814f4380, {{28.0, 321.0}, {90.0, 175.0}}, identifier: 'Waterfall Loop Trail, gpx', label: 'Waterfall Loop Trail, gpx, 9/16/19, 42 KB'
Since I'm trying to tap Waterfall Loop Trail, gpx
, I can now do:
app.cells["Waterfall Loop Trail, gpx"].tap()
I imagine I could use a similar strategy to interact with the other elements on this screen. It's super annoying that Xcode doesn't seem to support it in the recorder.