# Is there a way Open and Close the app under test?

**URL:** <https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734>\
**Category:** Support\
**Created:** [January 7, 2021, 4:32pm UTC](https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734 "2021-01-07T16:32:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![theo](https://discuss.appium.io/letter_avatar_proxy/v4/letter/t/a87d85/32.png) [@theo](https://discuss.appium.io/u/theo)\
**Post date:** [January 7, 2021, 4:32pm UTC](https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734/1 "2021-01-07T16:32:28Z")

</div>

_Language: Python_

I’m trying to create a test that involves checking a prompt appears after the app has been launched a second time.

Naturally this means using `self.driver.launch_app` isn’t going to work here as that seems to reinstall the whole thing and clear the apps data.

Any suggestions are appreciated

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [January 7, 2021, 5:12pm UTC](https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734/2 "2021-01-07T17:12:39Z")

</div>

there is no problem with “driver.launchApp();” for us. looks like problem in your capabilities when you start test. we use above with normal app start. our start cases are -\> [Different capabilities for different scenarios](https://discuss.appium.io/t/different-capabilities-for-different-scenarios/16694/3)

---

<div class="post-metadata">

**Author:** ![theo](https://discuss.appium.io/letter_avatar_proxy/v4/letter/t/a87d85/32.png) [@theo](https://discuss.appium.io/u/theo)\
**Post date:** [January 8, 2021, 9:06am UTC](https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734/3 "2021-01-08T09:06:26Z")

</div>

Thanks for the response @Aleksei . I followed your “normal start” code by setting fullReset to true and noReset to false but it still reinstalls once launch\_app is called… This is probably something that just won’t work on iOS.

---

<div class="post-metadata">

**Author:** ![theo](https://discuss.appium.io/letter_avatar_proxy/v4/letter/t/a87d85/32.png) [@theo](https://discuss.appium.io/u/theo)\
**Post date:** [January 8, 2021, 9:12am UTC](https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734/4 "2021-01-08T09:12:50Z")

</div>

For reference here’s all my other caps after setting the reset capabilities in code

> {‘webStorageEnabled’: False, ‘locationContextEnabled’: False, ‘browserName’: ‘’, ‘platform’: ‘MAC’, ‘javascriptEnabled’: True, ‘databaseEnabled’: False, ‘takesScreenshot’: True, ‘networkConnectionEnabled’: False, ‘platformName’: ‘iOS’, ‘platformVersion’: ‘14.3’, ‘deviceName’: ‘iPhone 11 Pro Max’, ‘app’: ‘ **.app’, ‘newCommandTimeout’: 9999, ‘autoGrantPermissions’: ‘false’, ‘udid’: '** \*\*’, ‘fullReset’: False, ‘noReset’: True}

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [January 8, 2021, 9:51am UTC](https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734/5 "2021-01-08T09:51:16Z")

</div>

no problem with us. ios 14.2. leaving our caps in case (deleted company sensitive info):

```auto
{
  app: REMOVED,
  automationName: XCuiTest,
  bundleId: REMOVED,
  clearSystemFiles: true,
  derivedDataPath: REMOVED,
  deviceName: iPhoneQA10,
  fullContextList: true,
  fullReset: false,
  iosInstallPause: 500,
  mjpegServerPort: 6210,
  nativeWebTap: true,
  newCommandTimeout: 180,
  noReset: true,
  platformName: iOS,
  platformVersion: 14.1,
  processArguments: {
    "args": ["REMOVED"]
  },
  sendKeyStrategy: grouped,
  shouldUseSingletonTestManager: false,
  showXcodeLog: false,
  skipDeviceInitialization: true,
  skipServerInstallation: true,
  udid: REMOVED
  useJSONSource: true,
  useNewWDA: false,
  usePrebuiltWDA: true,
  waitForQuiescence: false,
  wdaLaunchTimeout: 120000,
  wdaLocalPort: 6110,
  wdaStartupRetries: 4,
  xcodeOrgId: REMOVED,
  xcodeSigningId: iPhone Developer
 }

```

---

<div class="post-metadata">

**Author:** ![theo](https://discuss.appium.io/letter_avatar_proxy/v4/letter/t/a87d85/32.png) [@theo](https://discuss.appium.io/u/theo)\
**Post date:** [January 8, 2021, 1:19pm UTC](https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734/6 "2021-01-08T13:19:52Z")

</div>

Interesting as I’m using 14.3. I managed to get it working by using activateApp at the very least.

```
        self._driver.terminate_app('com.myApp.development')
        self._driver.activate_app('com.myApp.development')
```

---

<div class="post-metadata">

**Author:** ![Aleksei](https://discuss.appium.io/user_avatar/discuss.appium.io/aleksei/32/6267_2.png) [@Aleksei](https://discuss.appium.io/u/Aleksei)\
**Post date:** [January 8, 2021, 2:00pm UTC](https://discuss.appium.io/t/is-there-a-way-open-and-close-the-app-under-test/32734/7 "2021-01-08T14:00:01Z")

</div>

we used same before but now works “launch” for us.
