[HowTo] Open iPhone application using Sikuli

Asked by sonal gawand

**** Solution provided by Raymond Gonzales --- Thanks!

Here is how you can open an iphone app in the simulator:

Download and make the following tool:
https://github.com/landonf/iphonesim

----------------------------------------------------------------------------------

****Build your app with the xcodebuild command:

example (note this is not the end all be all of building an xcode project):
xcodebuild -scheme [SCHEME OPTION] -target [PROJECT TARGET] -sdk [SDK VERSION] -configuration [USUALLY Debug OR Release] clean build

****with the latest xcode 4.2, the app should be built in the following location:

/Users/[HOME DIRECOTRY]/Library/Developer/Xcode/DerivedData/[NAME OF APP]-cgxlojxaxievlientprexqrbjuxt/Build/Products/Debug-iphonesimulator/myApp.app

****copy the app file to the location where the iphonesim exec file is at so that it makes it easier on you...trust me...its best...

****then you use the iphonesim tool
./iphonesim launch [ABSOLUTE PATH OF THE APP]/myApp.app

Example:
    ./iphonesim launch --device-family iPhone --sdk-version 5.0 ~/Project/build/Debug-iphonesimulator/Project.app

---------------------------------------------

you can easily do all of this in sikuli by using s.type method in the Terminal app

Actually I use java to control sikuli and have found it easier to create a bash script and just run that to build and launch my app in the ios simulator. But yeah....

This is by far the best way to get your app into the simulator and launched.

**********************************************************
Hi,
Can we open the iphone application by specifying its location present in the mac using sikuli.
i had an application stored at a location /Users/syntel/Library/Application Support/iPhone Simulator/4.2/Applications/227C829B-B3B8-409D-BF6D-ACC5A8B8D589/PDFViewer.app

to launch the application using sikuli i am trying to write
def setUp(self):
  openApp("/Users/syntel/Library/Application Support/iPhone Simulator/4.2/Applications/227C829B-B3B8-409D-BF6D-ACC5A8B8D589/PDFViewer.app")

but the application is not getting launched on simulator.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Since I am not familiar with iPhoneSimulator in practice:

Does the PDFViewer.app start in the simulator, if you double-click on
/Users/syntel/Library/Application Support/iPhone Simulator/4.2/Applications/227C829B-B3B8-409D-BF6D-ACC5A8B8D589/PDFViewer.app
in the Finder?

Revision history for this message
sonal gawand (sonal-gawand) said :
#2

No it doesn't gets opened on double click from finder.
So if we need to launch an iphone application then what steps do we need to take.
As suggested in your examples to open a app you had written
      def setUp(self):
      openApp("/Applications/jEdit.app")
      wait(, 20000)
     close = ()

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Ok, so you cannot open an iPhone application on your simulator using openApp() (this only opens applications, that could be double-clicked to be opened on your Mac (e.g. the simulator can be opened with openApp("iPhone Simulator") or something like that ;-).

So how do you open an iPhone application on the simulator?

This has to be simulated by a Sikuli script.

If you tell me, what you are doing manually, to start the PDFviewer.app on the iPhone from outside of the simulator, I can give you more tips.

Revision history for this message
sonal gawand (sonal-gawand) said :
#4

We do open any iphone application on simulator by running its source code present in Xcode, this launches the app on simulator.
and the .app gets created in the documents directory.

for example, pdfviewer applications build got created at

/Users/syntel/Library/Application Support/iPhone Simulator/4.2/Applications/227C829B-B3B8-409D-BF6D-ACC5A8B8D589/PDFViewer.app

Revision history for this message
RaiMan (raimund-hocke) said :
#5

Ok, then you have to simulate this in Sikuli script:

switchApp("XCode")

Then you have to use some type() and paste() operations to get your app built and started on iPhone simulator.

You should simulate keyboard shortcuts using type() as often as possible instead of click(), because this is faster and usually easier to implement.

Revision history for this message
Raymond Gonzales (atlas1015) said :
#6

Here is how you can open an iphone app in the simulator:

Download and make the following tool:
https://github.com/landonf/iphonesim

----------------------------------------------------------------------------------

****Build your app with the xcodebuild command:

example (note this is not the end all be all of building an xcode project):
xcodebuild -scheme [SCHEME OPTION] -target [PROJECT TARGET] -sdk [SDK VERSION] -configuration [USUALLY Debug OR Release] clean build

****with the latest xcode 4.2, the app should be built in the following location:

/Users/[HOME DIRECOTRY]/Library/Developer/Xcode/DerivedData/[NAME OF APP]-cgxlojxaxievlientprexqrbjuxt/Build/Products/Debug-iphonesimulator/myApp.app

****copy the app file to the location where the iphonesim exec file is at so that it makes it easier on you...trust me...its best...

****then you use the iphonesim tool
./iphonesim launch [ABSOLUTE PATH OF THE APP]/myApp.app

Example:
    ./iphonesim launch --device-family iPhone --sdk-version 5.0 ~/Project/build/Debug-iphonesimulator/Project.app

---------------------------------------------

you can easily do all of this in sikuli by using s.type method in the Terminal app

Actually I use java to control sikuli and have found it easier to create a bash script and just run that to build and launch my app in the ios simulator. But yeah....

This is by far the best way to get your app into the simulator and launched.

Revision history for this message
RaiMan (raimund-hocke) said :
#7

@ Raymond
Thanx for your great contribution.

Can you help with this problem?

Provide an answer of your own, or ask sonal gawand for more information if necessary.

To post a message you must log in.