Environment setup in appium

In this section, we will see how to install Appium on Mac (High Sierra 10.13.6) and what are the prerequisites. Before you install appium, you need to install bunch of tools as mentioned below.
  1. Install Homebrew - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Install IntelliJ IDEA app
  3. Download and install jdk dmg from oracle site or use command brew cask install java
  4. Download and install maven - brew install maven
  5. Install NVM - brew install NVM Once NVM is installed, NVM ls command can be used to see all Node versions. NVM use command can be used to use specific node version
  6. Install node using NVM - NVM install 10.5
  7. Install appium - You can install appium in 2 ways - GUI or command line. To download app, head to http://appium.io/downloads.html. To install appium via command line, execute command npm install -g appium
  8. android studio or Android SDK command line tools
  9. npm install -g appium-doctor
  10. Set variables in .bash_profile file. See below for what variables needs to be set

Bash profile file for Appium environment


export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh

export ANDROID_HOME=/Users/admin/Library/Android/sdk
export PATH=${PATH}:/User/admin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
export PATH=${PATH}:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:/usr/local/bin/mvn

Appium environment for iOS App automation

  1. brew install carthage
  2. Install Xcode - Download app file and keep it in applications directory
  3. Install Xcode command line tools (git, gcc, c++) - xcode-select --install

JDK Installation

usr/bin/java is where java will be installed by brew. usr/local/bin/mvn is where maven is installed. Actual location of Java is /library/java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home. But it may change depending upon what version of Java you are installing.

#Export variable
export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)

If you want to add any path to PATH variable, you can use below command.

#Update PATH variable
export PATH=/opt/apache-maven-3.6.0/bin:$PATH 

If you want to see value of any variable, you can use below command.

#Print variable
Echo $JAVA_HOME

For installing different Java versions using cask, use below commands

#Using cask
brew tap homebrew/cask-versions
brew search java
brew cask install java7 
brew cask install java6

Some useful commands are here.

#View all installed Java versions
/usr/libexec/java_home -V
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
java -version
npm install -g appium-doctor
appium-doctor

If any tool is missing, appium doctor will tell exactly which tools are not installed.

Node and Appium version compatibility

It is important that versions of Node and Appium are compatible. If node version is not compatible, appium will not work properly. e.g. When I upgraded the Node version to 10.5, appium started working without any issues. You can use NVM to manage Node version.

Web development and Automation testing

solutions delivered!!