Last active
January 4, 2016 21:46
-
-
Save wuhao5/b62ea6f997ce87792817 to your computer and use it in GitHub Desktop.
Appium UIA iOS 9.x workaround for backgrouding app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "appium_lib" | |
APP_PATH="./node_modules/appium-uiauto/test/assets/UICatalog.app" | |
def desired_caps | |
{ | |
caps: { | |
platformName: 'iOS', | |
deviceName: 'iPhone 6', | |
versionNumber: '9.2', | |
# appName: 'UICatalog', | |
app: APP_PATH | |
}, | |
appium_lib: { | |
sauce_username: nil, # don't run on sauce | |
sauce_access_key: nil, | |
wait: 10, | |
} | |
} | |
end | |
driver = Appium::Driver.new desired_caps | |
begin | |
driver.start_driver | |
driver.set_context "NATIVE_APP" | |
sleep 5 | |
driver.background_app 4 | |
sleep 3 | |
rescue Exception | |
p $! | |
puts $@ | |
ensure | |
driver.x | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment