I am using EarlGrey framework but not sure which will be the method used to capture text value from an UI lable/ Textfield when using accessibility ID.
Asked
Active
Viewed 468 times
1 Answers
0
You can use grey_accessibilityID("")
Like so:
class MyFirstEarlGreyTest: XCTestCase {
func testExample() {
EarlGrey
.select(elementWithMatcher: grey_accessibilityID("phone_number_text_field"))
.assert(grey_sufficientlyVisible())
.perform(grey_replaceText("1234"))
}
}
I hope this helps!

Glenn Posadas
- 12,555
- 6
- 54
- 95
-
Hi Glenn, actually with accessibility ID I want to fetch the value inside a label or a textfield. – Satadip Ghosh Jan 16 '19 at 11:38
-
I don't think you can do that :/ – Glenn Posadas Jan 16 '19 at 11:45
-
You can create a custom matcher and then extract the value using it. Take a look at the FunctionalTests project for more info. – gran_profaci Jan 16 '19 at 21:34
-
In which part of the functional test project, thanks – Satadip Ghosh Jan 17 '19 at 06:00