Using XCUITesting to access images using photos picker. The code is roughly like this:
photoPickerButton.click()
try await Task.sleep(for: .seconds(2))
let images = app.descendants(matching: .image)
.matching(identifier: "PXGGridLayout-Info")
// select the first 5 images
for ix in 0..<5 {
let image = images.element(boundBy: ix)
if image.exists {
image.click()
}
}
// why do I have to click this twice? Output says the second
// click does "Falling back to element center point".
app.buttons["Add"].firstMatch.click()
app.buttons["Add"].firstMatch.click()
Other than the minor annoyance of having to click the Add button twice that works fine.
The issue is the second time in the same test I run almost identical code, but only try to select the first image as a test for handling duplicate selections.
Doesn't work. The first image returned from the query exists, but is not hittable. This is a testing issue as running the steps manually work fine.
The element I want to click is this:
Attributes: Image, 0x73511d540, {{1794.0, 745.2}, {98.0, 73.5}}, identifier: 'PXGGridLayout-Info', label: 'February 02, 1:00 PM'
Any ideas?