maestro: "Unable to obtain active app id" error on maestro commands for iOS

I get the error below when running commands on an iOS simulator on the latest maestro version (1.19.5):

Commands that I’ve tested so far and that are failing: test, studio, and hierarchy.

Click to see the complete error log

java.lang.IllegalStateException: Unable to obtain active app id                      
        at ios.xctest.XCTestIOSDevice.contentDescriptor(XCTestIOSDevice.kt:48)       
        at ios.LocalIOSDevice.contentDescriptor(LocalIOSDevice.kt:32)                
        at maestro.drivers.IOSDriver.contentDescriptor(IOSDriver.kt:175)             
        at maestro.Maestro$findElementWithTimeout$1.invoke(Maestro.kt:344)           
        at maestro.Maestro$findElementWithTimeout$1.invoke(Maestro.kt:343)           
        at maestro.utils.MaestroTimer.withTimeout(MaestroTimer.kt:16)                
        at maestro.Maestro.findElementWithTimeout(Maestro.kt:343)                    
        at maestro.orchestra.Orchestra.findElement(Orchestra.kt:646)                 
        at maestro.orchestra.Orchestra.findElement$default(Orchestra.kt:628)         
        at maestro.orchestra.Orchestra.tapOnElement(Orchestra.kt:558)                
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:159)              
        at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:443)                  
        at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:358)              
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:185)              
        at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:443)                  
        at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:358)              
        at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:185)              
        at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:137)             
        at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:91)                      
        at maestro.cli.runner.MaestroCommandRunner.runCommands(MaestroCommandRunner.kt:120)
        at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:36) 
	at maestro.cli.runner.TestRunner$runSingle$result$1.invoke(TestRunner.kt:32)
	at maestro.cli.runner.TestRunner.runCatching(TestRunner.kt:123)
	at maestro.cli.runner.TestRunner.runSingle(TestRunner.kt:32)
	at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:139)
	at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:100)
	at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:92)
	at maestro.cli.command.TestCommand.call(TestCommand.kt:100)
	at maestro.cli.command.TestCommand.call(TestCommand.kt:39)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
	at picocli.CommandLine.access$1200(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
	at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22)
	at picocli.CommandLine.execute(CommandLine.java:2058)
	at maestro.cli.AppKt.main(App.kt:122)

A few key points:

1 - When running xcrun simctl list devices booted I get only one device running, which is my emulator. 2 - I thought that it was a problem where I had Connect via network enabled on my physical device on Xcode’s Window > Devices and Simulators > Devices > Select my physical device, so I disabled it and the error still persisted. Tried disabling the option Show as run destination as well. 3 - Tried to set the device id with maestro --device=[DEVICE_ID_HERE] test clear_safari_cache.yaml. 4 - Tried with different and newly created iOS simulators. 5 - Tried restarting the mac. 6 - The same error is happening when I try to run maestro studio. 7 - The same error is also occurring on maestro version 1.19.2, which leads me to ask: is there a problem with external dependencies getting upgraded and breaking maestro? 8 - Upon locally running the command xcrun simctl listapps booted in this function, the app that I’m using as the appId property of the yaml test file is being listed properly.

Steps to reproduce:

1 - Boot an iOS Simulator 2 - Create the file below and name it clear_safari_cache.yaml 3 - Run maestro test clear_safari_cache.yaml

appId: com.apple.Preferences
---
- launchApp
- tapOn: "Safari"
- swipe:
    direction: UP
    duration: 300
- tapOn: "Clear History and Website Data"
- tapOn: "Clear History and Data"
- tapOn: "Close Tabs"
- stopApp

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 36 (16 by maintainers)

Most upvoted comments

This should be fixed now folks, feel free to download the new version of maestro. Feel free to reach out in case you find any issues.

Maestro version: 1.22.1

@amanjeetsingh150 I had the Logitech Hub service, the one that manages my Logitech Mouse, running on port 9080. Killing the service made it work locally. I’m gonna trigger a new build in the CI (Codemagic) with the latest Maestro version and see what happens.

Hey @efstathiosntonas thanks for the info does it continuously fail with this exception? Can you try with new terminal session?

@amanjeetsingh150 sure, will check asap

Hey, @edgarfroes can you dump bug report with maestro bugreport and submit all the reports in a zip.