-2

Is it possible to create a python script that I can use, to run the iOS simulator?

For example, I would use the python script to run the iOS simulator, run a specific app on the simulator, and go through the app and take screenshots.

Is this possible?

Chris
  • 361
  • 1
  • 4
  • 17
  • You should look into using Fastlane for taking screenshots of your application https://docs.fastlane.tools/getting-started/ios/screenshots/ – Andrew May 09 '21 at 15:44

1 Answers1

2

Well you could use

import subprocess

subprocess.call(
    ["/usr/bin/open", "-W", "-n", "-a", "/Applications/TextEdit.app"]
    )

to open any app on your Mac see this post How to open an application in Mac OS using Python

You will probably have to go through your app by yourself. Have also a look at that post Automate Screenshots on iPhone Simulator?

mufumade
  • 400
  • 4
  • 16
  • Awesome! Do you know of a way to mimic user touch’s with python? So I start the simulator, and now I want to open up “my app”, and I want to touch some buttons. I then take a screenshot. The use case for this, is I am remoting into my Mac, and I need to automatically take screenshots – Chris May 09 '21 at 16:24
  • 1
    Well of course you can mimic a mouse click see: [Controlling mouse with Python](https://stackoverflow.com/questions/1181464/controlling-mouse-with-python) but you have to configure that manually... And for the screenshot part you could trigger the hotkey that's available. But all this will be pretty tedious... – mufumade May 09 '21 at 16:47
  • Yes, that is amazing! This is exactly what I wanted! It is tedious, but I do screenshots for advertising every day manually. Making the script will make my life so much easier lol – Chris May 09 '21 at 16:52
  • Consider accepting my answer as correct if that's what you wanted. Thanks and happy coding. – mufumade May 09 '21 at 17:04