seenu reddy seenu reddy - 1 year ago 73
iOS Question

how to handle iframes using iOS webdriver, i am using iPhone 5s & 6S+? Kindly help me on this

I am unable to do mouse and keyboard action in iPhone 5s and 6S+. Because of website contains iFrames. how to handle iframes in iOS (Mobile devices) ?

Thanks in advance

Answer Source

If iFrames are present, you'll need to get their inner document to do mouse and keyboard actions. For UIWebView or WKWebView, this means adding 2 lines to the beginning of your script to insert into the webpage. Example:

NSString *scriptToInsert=@"var iFrame=document.getElementById('idOfFrame'); \
                           var innerDoc=iFrame.innerDocument || iFrame.contentWindow.document; \
                           //Now do other things w/ innerDoc instead of document

Now, you would insert your script.

[self.webView stringByEvaluatingJavaScriptFromString:scriptToInsert];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download