Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set a Id to my textbox in Swift

I want to set a Identifier to my text boxes and buttons, because I want to automate my app using Appium.

So my question is, in Xcode, what can I do to set a Id for my options, Its possible to do that, because all the programs that I have inspect has a id.

like image 348
Matheus Marques Avatar asked Mar 20 '18 14:03

Matheus Marques


People also ask

How do I restrict UITextField to take only numbers in Swift?

Method 1: Changing the Text Field Type from storyboard. Select the text field that you want to restrict to numeric input. Go to its attribute inspector. Select the keyboard type and choose number pad from there.

What is UITextField?

An object that displays an editable text area in your interface.


1 Answers

You just need to give it an accessibility identifier.

You can add this as a user defined runtime attribute, do it in code or the easiest is to add it through the property inspector.

Code

titleLabel.accessibilityIdentifier = "titleLabel"

Property Inspector

enter image description here

like image 98
Scriptable Avatar answered Nov 09 '22 15:11

Scriptable