Pre-requisites for Mobile App Test AutomationSetup and Configure Appium on Mac Operating System

Setup and Configure Appium on Mac Operating System

The following instructions outline the process of setting up an Appium instance on a macOS machine and configuring it to manage iOS devices.

Prerequisites

  • A macOS machine where the Appium server will be running. The supported Appium version is 2.x. To set up the Appium server, click here.
  • The XCUITest driver must be installed on the Appium server. For more information, see the driver description in the Appium documentation: The XCUITest Driver for iOS.
  • Your Python environment must have network access to the macOS machine.

Install Homebrew, Carthage, and Node.js

Install Homebrew

Homebrew is a package management system that makes it easier to install software on macOS machines. To install Homebrew, click here and follow the instructions.

Install Carthage (a dependency manager).

To do this, open the Terminal window and run the following command:

brew install carthage

Install Node.js and npm.

Install Node.js and npm. To do this, run the following command:

brew install node

Install Java

Download the JDK

Download the JDK from the Oracle website.

Run the downloaded installer and follow the on-screen instructions.

The JDK installation wizard guides you through the setup process.

Run the following command in the Terminal:

Run /usr/libexec/java_home --v to display the location of the JDK on your computer. The output will be similar to the following path: /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home. Copy the path.

Open your .bash_profile file in an editor and add the following two lines to it:

export JAVA_HOME="copied-path-to-JDK-directory"
export PATH=$JAVA_HOME/bin:$PATH

Save the changes.

Save the .bash_profile file to apply the environment variable updates.

Restart the Terminal to load the new .bash_profile settings.

Close and reopen the Terminal to ensure the changes take effect.

Install Appium

To install Appium with npm, run the following command in the Terminal window:

npm install -g appium

It is recommended that you install Appium Doctor in addition to Appium. It will help you fix issues with Appium and iOS settings. To install Appium Doctor, run the following command in Terminal:

npm install -g appium-doctor

Install Xcode and Xcode Command-Line Tools

  1. Download Xcode. Run the installer and follow the on-screen instructions.
  2. To install the Xcode command-line tools, run the following command in the Terminal:
xcode-select --install

Install WebDriverAgent

WebDriverAgent is a WebDriver version for iOS. It is used to control iOS devices and apps remotely.

You can find it in the following directory if you have installed Appium via Node.js

/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent

To install:

  1. In the Terminal window, go to the directory specified in the previous step and run the following commands:
mkdir -p Resources/WebDriverAgent.bundle
./Scripts/bootstrap.sh -d
  1. Open the WebDriverAgent.xcodeproj project in Xcode (you can find the project in one of the directories specified in the previous step).