diff --git a/README.md b/README.md
index e4e29a30..18c1aaf5 100644
--- a/README.md
+++ b/README.md
@@ -695,13 +695,13 @@ Closes the app and leaves it running in the background.
- Type: launch_app
Role: role1
- Value: com.android.vending (Optional - Android app package / iOS bundle ID)
+ Value: com.android.vending (Android app package / iOS bundle ID)
### terminate_app
- Type: terminate_app
Role: role1
- Value: com.apple.Preferences (Optional - Android app package / iOS bundle ID)
+ Value: com.apple.Preferences (Android app package / iOS bundle ID)
### start_record/end_record (Mobile)
diff --git a/lib/core/device.rb b/lib/core/device.rb
index c7da1457..fba1c171 100644
--- a/lib/core/device.rb
+++ b/lib/core/device.rb
@@ -250,34 +250,28 @@ def close_app(action = nil)
# launches the app specified by the Android app package / iOS bundle ID
# defaults to the app under test if Value is not provided
# Accepts:
- # Value (optional)
+ # Value
def launch_app(action)
+ raise "Please specify the application identifier in the Value field!" unless action.key?("Value")
app_id = action["Value"]
- if app_id
- if @platform == "iOS"
- @driver.execute_script('mobile: launchApp', {'bundleId': app_id})
- elsif @platform == "Android"
- @driver.activate_app(app_id)
- end
- else
- @driver.launch_app
+ if @platform == "iOS"
+ @driver.execute_script('mobile: launchApp', {'bundleId': app_id})
+ elsif @platform == "Android"
+ @driver.execute_script('mobile: activateApp', {'appId': app_id})
end
end
# closes the app specified by the Android app package / iOS bundle ID
# defaults to the app under test if Value is not provided
# Accepts:
- # Value (optional)
+ # Value
def terminate_app(action)
+ raise "Please specify the application identifier in the Value field!" unless action.key?("Value")
app_id = action["Value"]
- if app_id
- if @platform == "iOS"
- @driver.execute_script('mobile: terminateApp', {'bundleId': app_id})
- elsif @platform == "Android"
- @driver.terminate_app(app_id)
- end
- else
- @driver.close_app
+ if @platform == "iOS"
+ @driver.execute_script('mobile: terminateApp', {'bundleId': app_id})
+ elsif @platform == "Android"
+ @driver.execute_script('mobile: terminateApp', {'appId': app_id})
end
end