File tree Expand file tree Collapse file tree
src/main/java/io/appium/java_client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,13 +95,14 @@ default void resetApp() {
9595
9696 /**
9797 * Runs the current app as a background app for the time
98- * requested. This is a synchronous method, it returns after the back has
99- * been returned to the foreground .
98+ * requested. This is a synchronous method, it blocks while the
99+ * application is in background .
100100 *
101- * @param duration The time to run App in background. Minimum time resolution is one second
101+ * @param duration The time to run App in background. Minimum time resolution is one millisecond.
102+ * Passing zero or a negative value will switch to Home screen and return immediately.
102103 */
103104 default void runAppInBackground (Duration duration ) {
104- execute (RUN_APP_IN_BACKGROUND , ImmutableMap .of ("seconds" , duration .getSeconds () ));
105+ execute (RUN_APP_IN_BACKGROUND , ImmutableMap .of ("seconds" , duration .toMillis () / 1000.0 ));
105106 }
106107
107108 /**
Original file line number Diff line number Diff line change 1616
1717package io .appium .java_client .ios ;
1818
19- import static io .appium .java_client .MobileCommand .RUN_APP_IN_BACKGROUND ;
2019import static io .appium .java_client .MobileCommand .prepareArguments ;
2120import static org .openqa .selenium .remote .DriverCommand .EXECUTE_SCRIPT ;
2221
4342import org .openqa .selenium .remote .http .HttpClient ;
4443
4544import java .net .URL ;
46- import java .time .Duration ;
4745import java .util .Collections ;
4846import java .util .Map ;
4947
@@ -169,19 +167,6 @@ public IOSDriver(Capabilities desiredCapabilities) {
169167 super (updateDefaultPlatformName (desiredCapabilities , IOS_DEFAULT_PLATFORM ));
170168 }
171169
172- /**
173- * Runs the current app as a background app for the number of seconds
174- * or minimizes the app.
175- *
176- * @param duration The time to run App in background.
177- */
178- @ Override public void runAppInBackground (Duration duration ) {
179- // timeout parameter is expected to be in milliseconds
180- // float values are allowed
181- execute (RUN_APP_IN_BACKGROUND ,
182- prepareArguments ("seconds" , prepareArguments ("timeout" , duration .toMillis ())));
183- }
184-
185170 @ Override public TargetLocator switchTo () {
186171 return new InnerTargetLocator ();
187172 }
You can’t perform that action at this time.
0 commit comments