KIF 2.0 access element in UIWebview
Asked Answered
P

1

5

Can somebody tell me how to access an input field in a uiwebview in KIF 2.0? Unfortunately I can't find anything on KIF Framework Github, neither in the documentation nor in the examples. I tried to access the input field via its id but this doesn't seem to work:

[tester tapViewWithAccessibilityLabel:@"username"];.

Thanks in advance. And if you have some nice resources about KIF 2.0 I would be happy if you send them to me.

Philomenaphiloo answered 17/12, 2013 at 15:13 Comment(0)
C
9

In general, HTML text fields get their accessibility label from <label> tags. For example:

<label for=myField>My Field</label> <input id=myField>

In VoiceOver, this reads as a static text block "My Field", and a text field "My Field, Text Field, Double tap to edit." Both in VoiceOver and regular phone use, tapping the <label> will cause the text field to focus.

If you call [tester tapViewWithAccessibilityLabel:@"My Field"], KIF will send a tap event to the label, causing UIWebView to focus the text field. You can then use [tester enterTextIntoFirstResponder:@"..."] to enter your text.

Caning answered 17/12, 2013 at 17:4 Comment(1)
hi brian thanks. i will try it out tomorrow morning and will check the answer if I had success.Philomenaphiloo

© 2022 - 2024 — McMap. All rights reserved.