How to test iOS web application using Instruments UIAutomation - ios

When I test native application I can choose target (application from real device listed in the choose target list; or in the case with simulator - choose Profile menu item in application project).
But how can I choose target for web application?
Do I have to choose some browser as a target in this case? Device has Safari and Chrome browsers. Chrome browser appears in the list of targets. But when I try to run script, it does not works. Chrome is just launched, but any actions are performed.
I have also tried to create XCode project that simply open web page in browser. But when I try to run the script error "target application is not the frontmost" appears.
Is there some possibility to choose applications installed on the device as a target, if they are not present in the Instruments choose target list? There is a link to the web application on device home page. Can I somehow choose it as a target? In Organizer (called from XCode) only one - native - application is displayed.

UI Automation will only work for native applications built by you with Xcode. From your question it sounds like you want to launch Mobile Safari or Chrome for iOS and manipulate that with UI Automation. That won't work. Instruments can let you connect to applications you didn't compile running on the simulator or device, but only some of the instruments work and UI Automation isn't one of them.
If your web app was wrapped in a native shell then you could use UI Automation. You might want to look into Phone Gap. It's a full fledged wrapper that tries to expose native functionality to web apps, which you wouldn't need. But the fact that it's a well supported wrapper around web pages could be a great place to start if you still wanted to try this.

UI Automation doesn't support web automation. Try Selenium web driver for iOS, helps to automate web apps on iOS Safari browser. runs on both device and on simulator.

Related

phonegap app extremely slow to load website on ios

I have a phonegap app that opens a website using window.open(). While it works fine in testing, when I compile the app and install it on an iPhone using TestFlight it can take anywhere from 1 minute to 15 minutes to open the website. When it does everything works fine. The app store review is rejecting it because of the delay. What can I check to identify the cause of this delay?
Use remote debugging with an iOS device (or a simulator). This will allow you to see error's log like debugging a web site.
See "Safari in iOS" in : https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/GettingStarted/GettingStarted.html
Open the Settings app.
Tap Safari.
Scroll down and select Advanced.
Switch Web Inspector to ON.
After Web Inspector is enabled, connect your device to your desktop machine with a USB cable. The name of your device appears in the Develop menu of Safari.
Also, depending of what you want to do, I suggest you, instead of using window.open, to use the cordova-plugin-inappbrowser plugin to open link in the browser (outside the webview of Cordova/Phonegap)

Debugging PhoneGap on Device

Normally I'm a JEE guy but these days I'm working on a mobile app. I chose PhoneGap because there are not so many needs to UI and I thought this would be the easiest way to serve the app on many platforms.
I'm wondering if my setup is good and if it's possible to get console output when running on the device. I'm working on MacOS and iPhone6.
I installed PhoneGap and Cordova via npm and serving the files with phonegap serve.
For local debugging I'm using the chrome plugin "Ripple".
For debugging on the device I'm using the PhoneGap Developer App from the AppStore, together with weinre on my Laptop to get some debugging data. In weinre I can see everything except console outputs. Is this normal? Or any idea how I could get the console to weinre, too?
I also found some tutorials on the web using XCode and some native iPhone emulator but didn't get this working yet. Which way is the more preferable way of debugging on device?
You don't need any tool for debugging cordova app. For iOS just start the app in stimulator and start safari. In safari go to Develop > 'your pc name' > ios simulator.
http://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787
For Android run the app in your device and in the chrome go to http://chrome://inspect/#devices
Weinre is quite old and should not be be used anymore, instead, you want to use the remote debugging tools in your browser. For iOS, you can use Safari to debug your Cordova app. I've got a full article here, https://dzone.com/articles/overview-mobile-debugging, but the process involves doing one setting on your mobile device, and then simply opening up Safari and going to the debug menu. You can also do this with Chrome and Android apps.
Another option is GapDebug (https://www.genuitec.com/products/gapdebug/) which lets you do iOS and Android together in one Chrome tab.

jquery mobile application works in chrome simulator but not in actual device

We have a ASP.net web application integrated with DotNetNuke.
The mobile version uses jQuery mobile 1.6.X.
While trying to test the application it works well in Chrome simulator(our staging environment is publicly exposed). But it does not work in any of the actual device.
Can anyone suggest how to debug this ?
For Android you can attach the device to the pc and go to chrome-> developer tools -> inspect devices
Make sure your phone is set to developers mode with usb debugging on.
For iOS you can attach your phone to a mac and open safari, develop menu and then the device you want to inspect.
There you will find the javascript console, source, style and everything you normally need for website debugging.

Get access to console in Sencha Touch app running on iPhone

I want to use console.time('a') and console.timeEnd('a') in my Sencha Touch iOS app. This functions prinnt measured time in microseconds on console.
How to get access to console while I'm running my app on iPhone?
I tried with Safari Remote Web Inspector (like Phonegap iOS Safari debug workflow), but it doesn't work. It give me access to index.html, and Web Inspector opens correctly, but all his tabs are empty including console tab.
(I tried used Safari Remote Web Inspector with PhoneGap and it works correctly)
EDIT:
I don't use Xcode, becouse I am building my app with Sencha Cmd. And I do not want to change that, because I am testing Sencha Touch performance without PhoneGap.
There is a cordova plugin which you can use to see the output of console in XCode.

Phonegap iOS Safari debug workflow

I've been testing out Phonegap Build, using a similar workflow as outlined here:
Tutorial: Developing a PhoneGap Application
I can build, and deploy to my devices, but cannot get remote debugging to work through Safari, as described in the answer here:
Could you tell be debug process in Phonegap iOS application?
I have no problems debugging the app through the mobile browser, but the installed app itself does not show up in Safari's develop menu.
I am transferring my app to my phone through xCode, and have enabled debugging in the Phonegap build interface, but the Weinre debug service seems to be down. Ideally I'd like to get this working through Safari, could anyone share their debug workflow?
thanks
When you say "native app", you actually mean the Phonegap app deployed to your device?
Here is how I do it. It works on both iOS Simulator and actual device:
Open Settings > Safari > Advanced and make sure "Web Inspector" is enabled
Connect the device and deploy the Phonegap app using Xcode
Wait for the app to launch and navigate to Safari on my desktop, then find my device name in the develop menu
Make sure Web Inspector is enabled in Settings > Safari > Advanced > WebInspector.

Resources