In this post we will introduce the basic setup of Appium to work with iOS devices. We will go through with detailed steps, so you can skip some of those if you are familiar with.
For start you need to install Xcode. Go to the App Store, type Xcode, hit the download button and grab a coffee, it will take some time. Next step is to install Xcode command line tools. Open your default terminal application (Terminal, iTerm, etc.) and enter
xcode-select –install. Click on Install button on the presented popup.
Agree the fine print, wait for the components to be installed and click on Done. Don’t forget to accept the license and agreements of Xcode. Simply start Xcode, accept the licenses and wait for the components to be installed. Now we are able to start our iPhone/iPad simulator so if you want to try it out, switch to your Xcode and choose Xcode/Open Developer Tool/Simulator. The downside is that you will have just iOS 9 installed, and you can’t change it to the older version. Next chapter is to install Appium and required packages.
Install Appium with *.dmg files
Go to www.nodejs.org and click on Download. Start the downloaded file and go through the wizard. To verify that the node.js was installed correctly just type npm -v in terminal and check out the response. Go back to your browser and enter www.appium.io and hit the Download button. Mount the downloaded *.dmg file and move Appium.app to your Applications folder or wherever you want.
Install Appium across command line
So, if you familiar with command line, this will be your way. I’ll introduce every steps, so if you already own any of mentioned softwares below you can skip those steps. Switch back to your favorite terminal application and install Homebrew package manager with pasting
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
to your command line. When it’s done you can simply type brew install node to install node.js to your computer. Next step is to install core Appium with command npm install -g appium and the Appium client with command npm install wd. Hopefully everything is installed and configured properly, so you can start your Appium client with command appium &.
Nowadays problems with iOS 9 and Appium
Unfortunately Appium’s latest release, version 1.4.8 doesn’t have support for iOS 9 devices. However there is a beta version (1.4.13) which can be downloaded from https://bitbucket.org/appium/appium.app/downloads/. You can give it a try but I got error message like “Cannot find module ‘appium-instruments’” so I will introduce to you an another temporary solution.
Let’s install Appium version 1.4.13 with the following command:
npm install -g email@example.com
npm install wd
You can start Appium with command
appium & and you can also run your tests, but you can’t open Appium Inspector to get locators to your tests. To get this feature you can install any version (recommended 1.4.8) from *.dmg file and open it alongside with command line version. You can start Appium Inspector by clicking on the magnifier icon on the UI.
Stay tuned for the next part, where we will build a simple test case on iPhone (any version) in Java using Eclipse and JUnit.