Reputation: 3971
I have a label that gets its text assigned after a certain action happens, and I want to test that the text it has been assigned is correct with a UI test.
I am getting the XCUIElement with .descendantsMatchingType(.StaticText).elementBoundByIndex(UInt(3))
The element is a staticText, and the element.value is not returning anything useful, and I'm unable to find another way of getting any sort of useful value from the staticText, besides the debugDescription. However, it says in the docs that the debugDescription is unreliable and should not be used for the actual tests.
How can I verify that this label has the correct text?
Upvotes: 4
Views: 3432
Reputation: 3971
This has been answered with a recent update to XCUIElement
; there is now a label
property that gets the text from a .StaticText
element.
Upvotes: 2