Skip to content

Instantly share code, notes, and snippets.

@JaniJegoroff
Created March 27, 2014 14:03
Show Gist options
  • Save JaniJegoroff/d7f7887c88666e9f683d to your computer and use it in GitHub Desktop.
Save JaniJegoroff/d7f7887c88666e9f683d to your computer and use it in GitHub Desktop.
Xcode 5.1 / Simulator 7.1: Enable accessibility workaround
Before do |scenario|
enable_accessibility
@calabash_launcher = Calabash::Cucumber::Launcher.new
unless @calabash_launcher.calabash_no_launch?
@calabash_launcher.relaunch
@calabash_launcher.calabash_notify(self)
end
end
SIMULATOR = ENV['DEVICE_TARGET'].downcase.include?('simulator')
def enable_accessibility
# Enable accessibility and dismiss 'Accessibility Inspector' window
return unless SIMULATOR
accessibilityPlistPath = '~/Library/Application\ Support/iPhone\ Simulator/7.1/Library/Preferences/com.apple.Accessibility.plist'
`killall 'iPhone Simulator'`
`rm -rf ~/Library/Application\ Support/iPhone\ Simulator/`
`defaults write #{accessibilityPlistPath} "AXInspectorEnabled" '1'`
`defaults write #{accessibilityPlistPath} "AXInspector.enabled" '0'`
`defaults write #{accessibilityPlistPath} "AccessibilityEnabled" '1'`
`osascript -e 'tell application "iPhone Simulator" to activate'`
sleep 5
`defaults write #{accessibilityPlistPath} "AXInspectorEnabled" '0'`
`killall 'iPhone Simulator'`
end
enable_accessibility
@gsaslis
Copy link

gsaslis commented Jun 5, 2014

Hi there & thanks for this!
I did have a bit of trouble using it, until I changed the last defaults line to
defaults write #{accessibilityPlistPath} "AXInspectorEnabled" '1' (i.e. 1 instead of 0)

@JaniJegoroff
Copy link
Author

Hi gsaslis, thanks for the comment!
Similar workaround should be now integrated to calabash-ios version 0.9.169 so custom workaround should not be needed anymore. See https://groups.google.com/forum/#!topic/calabash-ios/aiMN5NEZM5I

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment