How to Programatically Turn on Guided Access on iPad/iOS Device? - ios

I am currently automating an app for iPad that needs to be set in Guided Access mode to work. I'm using Java with Selenium webdriver inside Eclipse. The app is all setup and being deployed through Xcode and I can interact with it just fine with the iOS driver.
The problem is the user cannot login until the iPad is set to Guided Access mode on this app. I know you can turn it on by triple clicking the Home button very quickly but I have not found a way to do that using code inside my tests.
Is there a way to send keyevents specific to the iPad Home button OR is there a way to set Guided Access mode programatically? Maybe set it in the capabilities before the iOS driver/app launches?

I'm not aware of any way to send events to the home button (pretty sure this wouldn't be possible).
You can programmatically enable / disable guided access however, using UIAccessibilityRequestGuidedAccessSession. In order for this to work, your device must be supervised using MDM and have a profile installed that enables single app mode for your application.
More details here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIAccessibilityRequestGuidedAccessSession

Related

Swift - how to access all pdf files on device

I am trying to build an app that will allow users to see all pdf files that are on the device (in some kind of a list with a preview) [Regardless of which app it belongs to on the device, all should be shown]. Is there anyway to achieve this?
Sorry but this is not possible on an iOS device because of a feature called sandboxing. Apple does not allow an app to access the sandbox of another app. Each app sits inside a sandbox of its own. This is iOS's security feature. There is no way to go around this feature.
Reference - About App Sandbox

How can I automate WiFi testing using Xcode Instruments?

I want to automate the UI flow on iOS, specifically below steps:
User taps on Settings
Opens WiFi options
Taps on the desired SSID
Enters Username and Password
Taps connect
Opens up a browser
I can do similar flow on Android with Android Debug Bridge. In Xcode Instruments, I don't see any WiFi options listed. Do we have any other tool to automate UI flow on iOS?
The standard is now to use UI Unit tests from XCode. Automation via instruments is deprecated (as far as I know).
However you can automate iOS itself, only the app you are testing. So accessing the settings like this will not work.
I'm also wondering why you need to test this. It's part of iOS and not your app. Therefore it's Apple's job to test it. You can just assume it works.
There is no way to do this on iOS. You may want to look into something like http://www.tapster.io.
Also ui_automation is remove from Xcode 8, so theres that.
I'm having pretty good luck with http://www.tapster.io

Access an iPads Device Settings using UIAutomation

Can you access the iPad Device settings using the UIAutomation instrument?
I can use deactivateAppForDuration, but that does not allow me to exit the app navigate to the settings page, change a setting, and navigate back to the app and move on.
any suggestion?
No, you cannot automate anything outside of the target application as of right now. When your app leaves the foreground the automation tool loses control until it returns (if it does at least).

How to app switch when guided access is enabled

I am building an app for kiosk usage and we're very happily using guided access mode. However, there is indeed a suite of apps and until recently, we were using URL scheme switching to switch between different apps. However, we found out that guided access doesn't allow URL switching.
Any suggestions?
(We want to keep apps separate for brevity)
I've heard back from Apple that this is not possible

Launching a different ios app, within an app

I'm writing a basic application using xcode 5.1. One of the features I'm interested in trying to do is to launch another app or move to other part of iphone, INSIDE the app already running.
Eg. I have an app with 3 menu options, 1 and 2 do certain tasks as part of this parent app, menu option 3 launches another app that's installed on the phone. I'm not sure if this is possible?
No you can not do that. Besides the documented URL handlers, there's no way to communicate with/launch another app.
This is part of the sandbox principle of apple:
https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/TheiOSEnvironment/TheiOSEnvironment.html
What you can do is launch another app by using custom URL-Schemes
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-working-with-url-schemes/

Resources