File tree 2 files changed +5
-19
lines changed
src/main/java/io/appium/java_client
2 files changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -95,13 +95,14 @@ default void resetApp() {
95
95
96
96
/**
97
97
* 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 .
100
100
*
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.
102
103
*/
103
104
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 ));
105
106
}
106
107
107
108
/**
Original file line number Diff line number Diff line change 16
16
17
17
package io .appium .java_client .ios ;
18
18
19
- import static io .appium .java_client .MobileCommand .RUN_APP_IN_BACKGROUND ;
20
19
import static io .appium .java_client .MobileCommand .prepareArguments ;
21
20
import static org .openqa .selenium .remote .DriverCommand .EXECUTE_SCRIPT ;
22
21
43
42
import org .openqa .selenium .remote .http .HttpClient ;
44
43
45
44
import java .net .URL ;
46
- import java .time .Duration ;
47
45
import java .util .Collections ;
48
46
import java .util .Map ;
49
47
@@ -169,19 +167,6 @@ public IOSDriver(Capabilities desiredCapabilities) {
169
167
super (updateDefaultPlatformName (desiredCapabilities , IOS_DEFAULT_PLATFORM ));
170
168
}
171
169
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
-
185
170
@ Override public TargetLocator switchTo () {
186
171
return new InnerTargetLocator ();
187
172
}
You can’t perform that action at this time.
0 commit comments