How to capture screenshots using UI automation on a iPhone? - iphone

I connected my iPhone 5s running iOS 8.3 to my mac which runs my script using "Automation Instrument" and I want to capture screenshots of UI during this process on my iPhone 5s and save them to my mac's disk at a particular location.
1.printing "target.logElementTree();" displays my elements but what I want is "Screenshot of device in realtime during run of automated script" so can we save the screenshot using this approach ????
2.I don't have the code of the app except the .ipa
Thanks for your time and efforts in going through or answering this question

With this command I am able to view the screenshot in trace log during automation.
UIATarget.localTarget().captureScreenWithName("Prabhu Konchada");
All we need to do is export these results to find them in the your desired folder !!!!

Related

Take Screenshot of minimized application with Powershell possible? Needed for OCR later

is there a way to take a screenshot from a minimized application or if another application is opened in front it?
I'm using Powershell currently for a small script which take a screenshot of a specific desktop area where the application is in the foreground. This screenshot is used for an OCR-process in the same Powershell-script to read some values out of it.
It would be great to capture in background or another solution that the computer can be used at same time the script is running. (screenshot like every 30s)

Force fake location on device?

I need to demo my app to my supervisor. At the minute I have set all the testing up so that it works with the highway drive in cali. When I demo it I will be in an office (stationary) so the real location data for the phone wont show the demo results at all.
Is there anyway to make the iphone do the city drive? - When its running natively i.e. not connected to the machine.
There are various CLLocationManager simulators on github that you could include in your demo build, such as the CLLocationManager_simulator here.
Alternately you can set up your apps to record location data to a file and then create a CLLocationManager simulator that plays back the file. With that testers can record test drives and then devs can play them back in the office to debug or examine what happened or retest with new builds.
If you don't mind using the Simulator to demo it, there's simulated location available. Look in the Simulator menu under Debug -> Location.

logs on second run of an ios application in the simulator

I have a question which seems like it should be a fairly common occurrence. I am trying to test code which only runs the first time an ios application is installed. While in principle this is very easy, I'm having trouble with it behaving properly the second time the app runs (note, this is not crash related).
I have been force running the app for a second time using the "Application does not run in background" flag in the plist, and then just hitting the home button. This works great, except i stop getting log data after the first run.
Does anyone know how to test for this situation in a way where you can continue seeing the log information after the app closes? For example, if there is a way to attach the xcode logger to the new process id? Or just another way to force an app reboot without losing the logging feature?
Thanks in advance!
Use the debugger menu:
Product>Attach To Process
(Results may vary with different versions of Xcode).
Also, you might need to insert a sleep at the very start of your launch to catch the very early log messages.
EDIT: If you're on a device then you can use the Device Organizer (cmd+shift+2) to watch all logs on a device.

Monitoring info about running processes of an iPhone with Objective C

I'm developing an iPhone app with XCode. I want to track the running applications of the phone and the memory, CPU usage for each of them. Still I wasn't able to find a way to do this. Can anyone help me?
Attach your iPhone to the Mac and "Profile" the app, selecting the Activity Monitor instrument. You should get the info you need from that.
EDIT: Changed 'PC' to 'Mac' (force of habit).

output different from simulator and iphone device

The output from simulator and iphone device is different. what is the actualy problem?can download the sample code from below link. the path of the road is not the same for both. i also need to move the car from start to end with the validation. currently my validation is not working.all the details are in Readme
Link Download (1.3MB)
There are a lot of situations where the behavior of the simulator and the device differs. Mostly they are triggered by bugs in your code, like messing up your memory management or trying to write to a file that isn't writable on the device.