简体   繁体   English

iPhone App中的UI自动化

[英]UI Automation in iPhone App

Hi people I have a serious problem at hand, I have made a sample iphone app with "username" and "password" field and a "login" button and I have set the accessibility labels for all the components to be username, password and login and written a java script to test these components which goes as follows -: 嗨,大家好,我手头有一个严重的问题,我制作了一个带有“用户名”和“密码”字段以及“登录”按钮的示例iPhone应用程序,并将所有组件的可访问性标签设置为用户名,密码和登录名并编写了一个Java脚本来测试这些组件,如下所示:

UIALogger.logStart("Starting Test"); UIALogger.logStart(“ Starting Test”); var view = UIATarget.localTarget().frontMostApp().mainWindow(); var view = UIATarget.localTarget()。frontMostApp()。mainWindow();

var textfields = view.textFields()["username"]; var textfields = view.textFields()[“ username”]; var passwordFields = view.secureTextFields(); var passwordFields = view.secureTextFields(); var convertButton = view.buttons()["login"]; var convertButton = view.buttons()[“ login”];

textfields.setValue("ABC"); textfields.setValue(“ ABC”); passwordFields[0].setValue("SDE"); passwordFields [0] .setValue(“ SDE”);

convertButton.tap(); convertButton.tap();

what I observe is that when I fire up instruments to test the app through the above java script, the js successfully enters value into the username field but is unable to enter the value in the password field which I have made secure also the button is tapped successfully and the control moves to the next page in the app and on the next page there is a logout button set with the accessibility label "logout" which also I am not able to tap on. 我观察到的是,当我通过上述Java脚本启动仪器以测试应用程序时,js成功在用户名字段中输入了值,但无法在我已确保安全的密码字段中输入了值,也点击了该按钮成功并将控件移至应用程序的下一页,然后在下一页上设置了带有可访问性标签“注销”的注销按钮,我也无法点击该按钮。 Can you please suggest a workaround for this situation if any. 您是否可以针对这种情况提出解决方法?

var passwordFields = view.secureTextFields();

How many secure text fields are there - what happens if you output the length of that array? 有多少个安全文本字段-如果输出该数组的长度会怎样?

Why not 为什么不

var passwordfield = view.secureTextFields()["password"];
passwordField.setValue("SDE");

in the same way you did for the text field? 以与您对文本字段相同的方式进行操作?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM