Setup Appium on OSX

Background

Appium is an open source test automation framework for use with native, hybrid and mobile web apps. It drives iOS, Android, and Windows apps using the WebDriver protocol.
– http://appium.io

Prerequisites

  • Xcode updated to latest version (through the App Store)
  • Simulator started or a physical device plugged into your Mac via USB
  • Java SDK installed and JAVA_HOME path set

Run the following commands, in Terminal, to install the necessary packages:

  1. homebrew
    • /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. npm
    • $ brew install node
  3. appium
    • $ npm i -g appium
  4. libimobliedevice
    • $ brew install libimobiledevice
  5. ios-deploy
    • $ npm install -g ios-deploy
  6. (Optional) appium-repl
    • $ npm install appium-repl -g
  7. Xcode command line tools
    • xcode-select --install
  8. Carthage
    • $ brew install carthage

Getting and Installing Appium

  1. In your web browser, navigate to https://github.com/appium/appium-desktop/releases/latest
  2. Download appium-desktop-#.#.#.dmg
  3. Open the .dmg file
  4. Drag the Appium icon to your Applications folder
    • Once complete, close the dmg’s window and delete the .dmg file
  5. Start Appium
    • (If prompted) Select “Open”
    • (Optional) Right-click the Appium icon in the dock and then select “Options” → “Keep in Dock”
  6. Click the “Start Server v#.#.#” button
  7. Click “⏸” (Stop Server) button
  8. Close the window to exit Appium Desktop

Start Inspector Session Using Xcode’s iOS Simulator

  1. Open XCode
  2. Select “Xcode” → “Open Developer Tool” → “Simulator”
    1. (Optional) Right-click the Simulator icon in the dock and then select “Options” → “Keep in Dock”
  3. Select “Hardware” → “Device” → “Manage Devices…”
    • Keep this window up for later
  4. Open Appium Desktop
  5. Click the “Start Server v#.#.#” button
  6. Click the “🔍” (Start Inspector Session) button
  7. Enter the following Desired Capabilities
    • automationName : XCUITest
    • platformName : iOS
    • deviceName : iPhone Simulator
    • app : {path_to_app}
  8. (Optional) Save the “Capability Set” by clicking the “Save” button
  9. Click the “Start Session” button
    • Note: The Simulator will close and a new “Appium” Simulator will be launched

Start Inspector Session Using a Physical iOS Device

The process is the same as with the Simulator, with two exceptions:

  1. Desired Capability – “app”
    • Should point to an “.ipa” instead of a “.app”
  2. Desired Capability – “deviceName”
    • Should match the Name under “Xcode” → “Window” → “Devices”