In Appium, what is the technical difference between the driver.terminate_app(bundleId)
and driver.close_app()
methods?
Asked
Active
Viewed 2,365 times
1

simpleuser
- 1,617
- 25
- 36
1 Answers
1
driver.terminate_app(bundleId)->
Terminates an existing application on the device. If the application is not running then the returned result will be false, otherwise true.
Supported arguments
bundleId: The bundle identifier of the application, which is going to be terminated. Mandatory argument.
Where driver.close_app() is actually used to end the session of the driver with the app. It is mostly written in the @AfterTest method that means after the executions of all of your tests the instance of the driver should be safely closed.
See the below code for driver.close()
public class Github1298Test {
@BeforeMethod
public void setUp() {
//initiate your driver instance
//give all capabilities
}
@Test
public void tearDown() {
driver.close_app();
}
}

Sammar Ahmad
- 236
- 5
- 16
-
After more playing around quite a bit, I note that `driver.close_app()` closes the session communication and driver connection, BUT leaves the session active in Appium (until the `newCommentTimeout` capability causes Appium to terminate it?) and does not close the app if running or backgrounded on the device, while `driver.quit()` will end the Appium session and close the app if running on the device. – simpleuser Oct 22 '19 at 20:26