ios - KIF 可以针对 UIWebView 组件吗?

标签 ios testing uiwebview kif-framework

是否可以在 KIF 测试中针对 UIWebView 组件?

我已经设法通过使用 stepToTapScreenAtPoint 获得了有限的功能,但是当目标内容处于“非首屏”时会出现重大问题。

我使用 stepToEnterText:kTestEmail intoViewWithAccessibilityLabel:@"Email"] 也取得了有限的成功,但尽管它可以找到输入字段并开始输入,但在完成输入后测试失败。

所以我的问题是 KIF 是否支持针对基于 webview 的步骤?正确的测试方法是什么?

谢谢! (KIF结果如下)

Integration[29024:c07] PASS (0.01s): Tap screen at point "{50, 520}"
2012-11-06 14:49:58.493 Integration[29024:c07] FAIL (4.48s): Type the text "[redacted]" into the view with accessibility label "Email"
2012-11-06 14:49:58.494 Integration[29024:c07] FAILING ERROR: Error Domain=KIFTest Code=0 "Failed to actually enter text "[redacted]" in field; instead, it was "SIGN UP
Sign in

Email

Password

   Stay signed in
Can't access your account?
Coming soon: A new sign-in page! Try it now Learn more
© 2012 Google Privacy Policy Help"" UserInfo=0x14eda060 {NSLocalizedDescription=Failed to actually enter text "[redacted]" in field; instead, it was "SIGN UP
Sign in

Email

Password

   Stay signed in
Can't access your account?
Coming soon: A new sign-in page! Try it now Learn more
© 2012 Google Privacy Policy Help"}
2012-11-06 14:49:58.494 Integration[29024:c07] ---------------------------------------------------
2012-11-06 14:49:58.494 Integration[29024:c07] END OF SCENARIO (duration 11.15s)
2012-11-06 14:49:58.495 Integration[29024:c07] 

最佳答案

一年后,仍然没有人发布解决方案,所以我将分享我遇到的类似问题,我只是通过使用第一响应者而不是输入文本字段来解决这个问题。

这是我项目中的代码片段。让它与你的一起工作。希望这对某人有帮助!

//Make sure the field is in view
[scenario addStep:[KIFTestStep stepToWaitForTappableViewWithAccessibilityLabel:@"Username"]];

//This will pop the keyboard to screen
[scenario addStep:[KIFTestStep stepToTapViewWithAccessibilityLabe:@"Username"]];

[scenario addStep:[KIFTestStep stepToEnterTextIntoCurrentFirstResponder:@"testUser"]];

关于ios - KIF 可以针对 UIWebView 组件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13258382/

相关文章:

ios - 自动调整 tableViewCell 中的 textView - iOS 9 (Objective-C)

ios - 约束未针对所有屏幕设备正确调整大小

javascript - 如何期望列表中是否存在项目

c++ - boost 测试 - 其他文件中的每个套件

ios - 如何在 UIWebView 中关闭页面并返回应用程序

ios - 每次运行测试时,Xcode 11 模拟器都会抛出警告消息

ios - 如何在我的 iOS 应用程序上接收短信(解决方法)?

android - Robotium:如何在 Activity 启动之前更新首选项?

iphone - 使用UIWebView显示html文件

iphone - 如何检测 UIWebView 上的触摸