Background App
Send the currently running app for this session to the background //将此会话当前正在运行的应用程序发送到后台
Example Usage
Java | driver.runAppInBackground(Duration.ofSeconds(10)); |
Python | self.driver.background_app(10) |
Javascript | // webdriver.io example driver.background(10); // wd example await driver.backgroundApp(10); |
Ruby | # ruby_lib example background_app(10) # ruby_lib_core example @driver.background_app(10) |
C# | driver.BackgroundApp(10) |
PHP | $driver->backgroundApp(10); |
Description
Send the currently active app to the background, and either return after a certain amount of time, or leave the app deactivated. There are 3 types of parameters which may be passed to this method: //将当前活动的应用程序发送到后台,并在一定时间后返回,或使应用程序处于停用状态。有3种类型的参数可以传递给此方法:
-
1.An object that looks like
{"seconds": secs}
, wheresecs
is an integer designating how long, in seconds, to background the app for. -1 means to deactivate the app entirely. -
2.
null
, which means to deactivate the app entirely. -
3.Deprecated An integer: how long, in seconds, to background the app for. -1 means to deactivate the app entirely.
iOS tests with XCUITest can also use themobile: terminateApp
method to terminate the current app (see detailed documentation), and themobile: activateApp
to activate an existing application on the device under test and moves it to the foreground (see detailed documentation).
Support
Appium Server
Appium Clients
HTTP API Specifications
Endpoint
POST /session/:session_id/appium/app/background
URL Parameters
name | description |
---|---|
session_id | ID of the session to route the command to |
JSON Parameters
name | type | description |
---|---|---|
seconds | number | How long to run app in background. |
Response
null