javascript - 无法在用于 iOS UI 测试的密码文本字段中输入文本

标签 javascript ios xcode xcode6 ios-ui-automation

这是我在 Xcode 上运行 UI 测试的代码:

     var target = UIATarget.localTarget();
     var app = target.frontMostApp();

     var window = app.mainWindow();

     //display the current screen 
     target.logElementTree();

     //set value as email address
     window.textFields()[0].setValue("test11@test.com");
     //set value in passcode 
     window.textFields()[1].setValue("1234");


     window.buttons()["SIGN IN"].tap();

应用程序界面如下所示: enter image description here

对于行:

    Window.textFields()[0].setValue("1234");

它显示:

    Unexpected error in -[UIATextField_0x7fc8ac0e360 setValue:],/SourceCache/UIAutomation_Sim/UIAutomation-430.2.1/Frameworks/UIElement.m.line 1088, kAXErrorCannotComplete

所以当脚本输入电子邮件地址而不是密码时它会起作用。我认为该应用程序检测到密码是由机器人而不是人类输入的。这就是它产生错误的原因?如果是这样,我该如何解决?

最佳答案

这是一个安全问题。

enter image description here

由于测试原因只需取消选中带圆圈的框,然后问题就解决了!!

关于javascript - 无法在用于 iOS UI 测试的密码文本字段中输入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32102826/

相关文章:

javascript - lodash过滤器返回无法读取null的属性 'indexOf'

ios - 阻止 ios : what is this method map: before a block?

ios - fatal error : Index out range in numberOfRowsInSection

iphone - 维护 UISegmentedControl 中的选择

Javascript - 计算围绕一个中心点的四个 Angular 的地理坐标点

javascript - Three.js:平滑地旋转与 OrbitControlscamera.rotation.y 相反的对象

iPhone 应用程序加载器故障排除

ios - 由于版本错误,无法在设备上启动用Swift编写的iOS应用

Javascript 字符串对象 V.S.只是字符串

ios - Facebook 登录问题 iOS9 + Parse