Is there a call to shut down the iOS simulator after a test run?

Is there a call to shut down the iOS simulator after a test run?

This command should shut down the simulator: driver.quit

It doesn’t shut it down. Do I need to close the app under test first? Because I am calling driver.closeApp() to do that, but it doesn’t close the app.

Do I need to use this?
capabilities.setCapability(“deviceName”, “iPhone Simulator”)

I am currently using
capabilities.setCapability(“deviceName”, “iPhone”)

If you have --no-reset specified in your server arguments, then it will not close the simulator when you call driver.quit()

You should not need to use driver.closeApp() first. Your deviceName should be "iPhone Simulator". I don’t know if that’s why the simulator isn’t closing.

Thanks! --no-reset isn’t specified when I start the server. I had deviceName set to “iPhone” but took your suggestion and changed it to “iPhone Simulator”. However, the simulator still doesn’t get shut down.

Hm. Try --full-reset in the server capabilities.

I was testing in Python client and driver.quit() does work, but there may be a difference in the Java versus Python client implementation.

For a workaround, you can do:

killall -9 "iPhone Simulator"

in any terminal session. I actually have a custom ‘clean()’ script that I wrote because I’m doing some extra setup and teardown, and I don’t want Appium cleaning itself, so I use the above command to shutdown the sim.

Note, it’ll throw an exception if it fails, so wrap it in a try/catch block.

:sunny: