I'm trying XCode for iOS UI testing. My test application has UITextView element with accessibility identifire displayTextView
.
I tried simple test that taps this element, types some text it and then check the result the following way:
XCUIElement *textView = app.textViews[@"displayTextView"];
[textView tap];
[textView typeText:@"9.9"];
It works. But then I can't get the typed text from the text view. I tried to do it by the following:
XCTAssertEqual([textView.accessibilityValue isEqualToString:@"9.9"]);
But it seems it is incorrect, because textView.accessibilityValue is null. What method would be appropriate to get the typed text?
I found the answer. The correct way is:
XCTAssert([textView.value isEqualToString:@"9.9"]);
or let text = textView.value as! String
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With