Search code examples
appiumpython-appium

Appium terminate vs close


In Appium, what is the technical difference between the driver.terminate_app(bundleId) and driver.close_app() methods?


Solution

  • 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();
     }
    

    }