Skip to content

Instantly share code, notes, and snippets.

@wuhao5
Last active January 4, 2016 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wuhao5/b62ea6f997ce87792817 to your computer and use it in GitHub Desktop.
Save wuhao5/b62ea6f997ce87792817 to your computer and use it in GitHub Desktop.
Appium UIA iOS 9.x workaround for backgrouding app
#!/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