2012-11-06 32 views
3

是否可以在KIF測試中定位UIWebView組件?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] 

回答

2

一年後,仍然沒有人職位的解決方案這樣的話,我會分享我也有類似的問題,我只是通過第一響應者,而不是進入繞製成一個工作文本字段。

這是我的代碼在我的項目中的一個片段。只要讓它與你的工作。希望這可以幫助別人!

//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"]]; 
相關問題