Appium tests via Jenkins: Simulator not booting, error: Command 'osascript -e 'tell application "System Events" to count processes whose bundle identifier is "com.apple.iphonesimulator"


#1

Appium version: 1.7.1
Xcode versions: 9.0 and 8.3.3
iOS Simulator version: iPhone 6, 10.3.1

A few months ago I was able to run my Appium tests through a local installation of Jenkins. I got sidetracked for a few months and am now coming back to it, but I’ve been unable to successfully run my tests. When I try to launch my application, my Jenkins build is called “Unstable” and I get the following error message:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Command 'osascript -e 'tell application "System Events" to count processes whose bundle identifier is "com.apple.iphonesimulator"'' exited with code 1 (WARNING: The server did not provide any stacktrace information)

I came across and resolved many errors during my first attempt at running Appium tests on Jenkins, but this is a new one.

The gist for the entire Jenkins log can be found here:

The log says that tests failed because specific elements cannot be found, but that’s because the simulator is not being booted. If I attempt to run the test with the simulator up and running the app doesn’t open, so the Appium server is getting started. The tests work as expected if I run them locally without Jenkins.

My project resides in Jenkins/workspace/SampleAppiumProjectIOS and includes the following files and folders:

  • .project
  • app (folder)
  • pom.xml
  • src (folder)
  • target (folder)
  • testng.xml

Things I’ve tried so far:

  • unlink and reinstall latest version of libimobiledevice
  • downgrade from Xcode 9 to Xcode 8.3.3 (including simulator downgrade)
  • updated my dependencies in my POM file to the most recent stable versions
  • delete the Target folder before running the Jenkins build
  • ran sudo $(npm bin)/authorize-ios
  • ran DevToolsSecurity -status; confirmed that Developer mode is currently enabled
  • started simulator with app installed before initiating Jenkins build
  • checked this URL while the build was in progress: http://127.0.0.1:4723/wd/hub/status (result below; app is not loading, so this is expected)
    05 PM

The same issue (or at least a very similar issue) was very recently posted on Stack Overflow: https://stackoverflow.com/questions/46569413/jenkins-couldnt-open-ios-simulator

Any insight or suggestions would be greatly appreciated. Thank you for reading.


Getting osacript error when trying to create iosDriver
#2

Did you resolve it in the end? I’m running into the same problem where appium doesn’t seem to find the iOS simulator.


#3

Sorry for the late response. My team eventually decided to move in a different direction, so we ended up abandoning Jenkins in favor of another solution. I never did figure this out. Sorry!


#4

No worries. I ended up using the real device for testing so I never able to figure this one out either.


#5

@chiwhitesox56 Just curious, instead of Jenkins, which system is your team using now?