0

I have a UITextView with Accessibility Identifier properly set up. When I try to hook this element usingapp.textViews["textViewIdentifier"] it does not work.

It probably does not work because I'm not setting up accessibility traits correctly. I don't see any traits available for UITextView in interface builder or documentation

Playing with different traits I was able to find the textview but it does not execute textView.typeText("test text") since traits don't match with type.

TextView is contained only in default UIView.

After more testing, the core of issue seems to setting up Accessibility traits correctly for UITextView. How do you correctly setup Accessibility Traits for UITextView?

Community
  • 1
  • 1
Saqib Saud
  • 2,799
  • 2
  • 27
  • 41

1 Answers1

1

As far as I understand your post, there are two questions here:

  • How do I set up an Accessibility Identifier
  • How do I type text in my textview during a UI test

I can answer the second question. You can either use po app.textViews in a breakpoint to see the identifier, or, if the textview is the only one on the page, use app.textViews.firstMatch.

If you need an answer to the first question I will leave that to someone else.

Reijer
  • 98
  • 1
  • 9
  • the textView indeed is the only one in the view and this solution still does not work. I believe this is because of not setting up Accessibility traits correctly because when I print app.DebugDescription It does not list that TextView as TextView. So the question is how to setup Accessibility traits correctly for UITextView – Saqib Saud Mar 06 '19 at 06:54