Xcode UI测试错误键盘 [英] Xcode UI Testing Error keyboard

查看:94
本文介绍了Xcode UI测试错误键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XCUIApplication *app = [[XCUIApplication alloc] init];
[app.buttons[@"Committee"] tap];
[app.buttons[@"Login"] tap];
[app.buttons[@"Add Presenter"] tap];

XCUIElement *nameTextField = app/*@START_MENU_TOKEN@*/.textFields[@"Name"]/*[[".scrollViews.textFields[@\"Name\"]",".textFields[@\"Name\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/;
[nameTextField tap];
[nameTextField typeText:@"A"];

XCUIElement *topicTextField = app/*@START_MENU_TOKEN@*/.textFields[@"Topic"]/*[[".scrollViews.textFields[@\"Topic\"]",".textFields[@\"Topic\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/;
[topicTextField tap];
[topicTextField tap];

我的错误是运行UI测试时,我收到UI测试失败

my error is when run the UI test I receive UI Testing Failure

元素和任何后代都不具有键盘焦点.

Neither element nor any descendant has keyboard focus.

属性:TextField,但是上面的测试通过了,我附上了一个截图,该截图完全失败了输入图像描述这里

Attributes: TextField however the test above passed I have attached a screenshot of what exactly failing enter image description here

推荐答案

我在Xcode 7.0.1中遇到了同样的问题,并且能够通过在模拟器设置中关闭连接的硬件键盘来解决此问题.硬件->键盘->连接硬件键盘(取消选中此选项).链接

I faced this same problem with Xcode 7.0.1 and was able to resolve it by turning off the connected hardware keyboard in the simulator settings. Hardware -> Keyboard -> Connect Hardware Keyboard (uncheck this). link

这篇关于Xcode UI测试错误键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆