How to handle Unable to boot device in current state: Booted

Hi all,

Good afternoon!

I have appium 2 automation for iOS, when i run the code via automation my simulator shows below pop-up then i have to manually click “ok” to open simulator eventhough my simulator is running automatically in code.

Unable to boot device in current state: Booted

Any solution in code to resolve this please?

XCUITestOptions ios =
new XCUITestOptions()
.setPlatformName(“iOS”)
.setDeviceName(“iPhone 13”)
.setOrientation(PORTRAIT)
.setCommandTimeouts(Duration.ofSeconds(240))
.setBundleId(
DataHelper.getPropertyValue(
“Environments.twlios.appium.bundleId”)) // or use bundleId
.setAutoDismissAlerts(true)
.setAutomationName(“XCUITest”)
.setClearSystemFiles(true)
.setNoReset(true)
.setApp(DataHelper.getPropertyValue(“xxxx”));

    try {
      driver = new IOSDriver(url, ios);

34%20PM

If you still have this issue, try the followings(in this order):

  1. https://stackoverflow.com/a/71249396/17539996 - iOS default behaviour is to launch the most recent used simulator so it might cause issues, try to disable this checkbox.
  2. https://stackoverflow.com/a/31922305/17539996 - this is a script you can execute to make sure the simulator’s state is shutdown. this is a good practice to keep a clean environment, note that you shutdown a specific device.
  3. https://stackoverflow.com/a/47523915/17539996 - if still occur, try this, note it will shutdown all simulators so you can use it only if you are not running simulators simultaneously.
1 Like

yeah… Below option working fine.Thanks lot.

I found solution. Simulator -> Preferences -> Simulator lifetime: When Simulator starts boot the most recently used simulator I unchecked.

But any way to handle that programmatically?

simply update xcuitest driver to the most recent version