I'm currently developing some UIAutomation tests for an iOS App using KIF Framework. At some point, the app has to open a WebView with a login page, enter username and password and then press the sign-in button and all of these have to be automated.
My question is: knowing that at a certain moment in time the app displays that login page, how can i get the WebView UI element as in:
UIWebView *webView = // . . . ?
Also, it would be great if you could tell me how to get those two text fields (username and password), something like:
UITextField *textField = // ... ?
Thank you.
the idea is that you want to kif to get hold of the webview after the webview has been loaded.. for that you will have to put the notifiying code in the webview delegate function webViewDidFinishLoad
in there.. you can put an NSNotification.. if you've used KIF for a while you know that you can instantiate actions only after you have recieved an
NSNotification
.. this is the the method in kif:+ (id)stepToWaitForNotificationName:(NSString*)name object:(id)object;
as for finding the UIWebView itself, you just have to give it the same accessibility label you do with any other UIElement in iOS.