0% found this document useful (0 votes)
13 views

Appium Installation Guide

Uploaded by

dhanashree
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Appium Installation Guide

Uploaded by

dhanashree
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Appium Installation & Configuration Guide

Table of Contents

Appium Installation & Configuration Guide.........................................................................1

Chapter 1: Introduction....................................................................................................3
Purpose..................................................................................................................................................... 3
Download Java......................................................................................................................................... 4
Download Android Studio and Android SDK......................................................................................... 7
Download Node........................................................................................................................................ 7
Set Windows system variables............................................................................................................... 8
Android Studio and Configure Emulator.............................................................................................. 20
Install and start the Appium Server via Node......................................................................................26
Download APK demo app...................................................................................................................... 27
Install Eclipse Editor.............................................................................................................................. 27

1
Setup Maven Project with Appium Dependencies..............................................................................28
Understanding the Desired Capabilities to setup the Environment in the Appium..........................28
Appium first program to invoke the Android Apps.............................................................................29

2
Chapter 1: Introduction

Purpose

The document will help end user to understand process of Appium installation and configuration on
Windows operating system

3
Download Java

Using browser Google for JDK download and download JDK 11.x for windows

https://www.oracle.com/java/technologies/downloads/#java11-windows

Download executable for 64 bit systems : Example - jdk-11.x.xx_windows-x64_bin.exe

Once installer is downloaded then simply double click on it and follow the installation steps

Set JAVA_HOME path

Step 1 : Navigate to folder where user install Java JDK from windows explorer and copy the folder
path

Step 2 : Go to Control Panel\All Control Panel Items\System and click on “Advanced System
settings”

Step 3: System Properties windows – Click on “Environment Variables”

4
Step 4: Environment Variable windows click on “New” of System variables

5
Step 5: Enter “Variable Name:” as “JAVA_HOME” and “Variable value:” as name of java folder
which you copied by executing Step 1

Click on “OK” button of New System Variable window

Click on “OK” button of Environment Variables window

6
Click on “OK” button of System Properties window

Download Android Studio and Android SDK

To work with Appium user will need Android SDK app and to install user needs to download
Android Studio.

Step 1: Google for “download android studio for windows” and install android studio with standard
mode.

Step 2 : Once Android studio is installed then install Android SDK by double clicking - C:\Program
Files\Android\Android Studio\bin\studio64.exe

Download Node

To run Appium test cases user needs to start Appium server and it is developed in Node.JS. All the
test cases to divert to Appium server and this server will invoke application on mobile.

Google “download node js for windows” and download .msi for Windows 64 bit.

Download - https://nodejs.org/en/download/

7
Once you download .msi file, double click on it and follow installation steps. This will install below
packages:

Set Windows system variables

Set below environment variables.

Pre-requisite user needs to enabled Android SDK Platform-Tools from Android Studio

Step 1 : Launch Android Studio application. If user opening Android studio 1 st time, then just follow
the instructions and create default android project. Project screen will look like below

Step 2 : Go to Tool => SDK Manager menu

8
Step 4 : From left pane select Appearance & Behavior => System Settings => Android SDK.

Click on “SDK Tools” tab from right side pane

Select “Show Package Details” option button – this will display packages

Select “Android SDK Platforms-Tools” option (if it is not selected)

Click on “OK” button

Add “ANDROID_HOME” variable

Step 1 Navigate to C:\Users\<Username>\AppData\Local\Android\Sdk and copy this folder path

Step 2: Go to Control Panel\All Control Panel Items\System and click on “Advanced System
settings”

9
Step 2: System Properties windows – Click on “Environment Variables”

Step 3: Environment Variable windows click on “New” of System variables

10
Step 4: Enter “Variable Name:” as “ADROID_HOME” and “Variable value:” as name of java folder
which you copied by executing Step 1

Click on “OK” button of New System Variable window

Click on “OK” button of Environment Variables window

11
Click on “OK” button of System Properties window

Add Android SDK folder path to system’s path variable

Step 1 Navigate to C:\Users\<Username>\AppData\Local\Android\Sdk\tools\bin and copy this folder


path

Step 2: Go to Control Panel\All Control Panel Items\System and click on “Advanced System
settings”

Step 2: System Properties windows – Click on “Environment Variables”

12
Step 3: Environment Variable windows select “Path” from “System variables” section and click on
“Edit” of System variables

13
Step 4:Click on “New” button, this will add one blank rows at bottom in existing list of environment
variable

14
Step 5 : Copy the C:\Users\<Username>\AppData\Local\Android\Sdk\tools\bin

Click on “OK” button

15
Step 6: Repeat the Step 1 to Step 5 to below paths:

C:\Users\ssughade\AppData\Local\Android\Sdk\tools

C:\Users\ssughade\AppData\Local\Android\Sdk\platform-tools

Click on “OK” button of New System Variable window

Click on “OK” button of Environment Variables window

Click on “OK” button of System Properties window

Add NODE_HOME variable

Step 1 Navigate to C:\Program Files\nodejs and copy this folder path

Step 2: Go to Control Panel\All Control Panel Items\System and click on “Advanced System
settings”

Step 2: System Properties windows – Click on “Environment Variables”

16
Step 3: Environment Variable windows click on “New” of System variables

17
Step 4: Enter “Variable Name:” as “NODE_HOME” and “Variable value:” as name of folder which
you copied by executing Step 1

Click on “OK” button of New System Variable window

Click on “OK” button of Environment Variables window

Click on “OK” button of System Properties window


18
Add “npm” bin folder path in System’s path

Step 1 Navigate to C:\Program Files\nodejs\node_modules\npm\bin and copy this folder path

Step 2: Go to Control Panel\All Control Panel Items\System and click on “Advanced System
settings”

Step 2: System Properties windows – Click on “Environment Variables”

19
Step 3: Environment Variable windows select “Path” from “System variables” section and click on
“Edit” of System variables

20
Step 4:Click on “New” button, this will add one blank rows at bottom in existing list of environment
variable

Step 5 : Copy the C:\Program Files\nodejs\node_modules\npm\bin

Click on “OK” button

Android Studio and Configure Emulator

Follow the below steps to configure Android Virtual Emulator.

Step 1 : Launch Android Studio application. If user opening Android studio 1 st time, then just follow
the instructions and create default android project. Project screen will look like below

21
Step 2 : Go to Tool => AVD Manager menu

Step 3: Click on “Create Virtual Device” button

Select “Phone” from “Category” pane

Select “Nesus 5” from list (User can select any desire device)

Click on “Next”

22
23
Select which Android version user wish to use. If the version is not install then user can click
“Download” button and download available latest android version

Select “Nougat”

Click on “Next” button

24
Enter “AVD Name” as “Demo_AVD”

Click on “Finish”

Newly created AVD will get save and it will be available in list

Select newly created AVD and click on “Run” icon next to it

25
Check the Virtual device will appears on your screen

26
Starting AVD from command line

cd C:\Users\ssughade\AppData\Local\Android\Sdk\platform-tools

emulator -avd <Virtual_Device_Name>

Install and start the Appium Server via Node


27
All mobile automaton test re-direct to Appium Server, so user has to start Appium Server. Default
port – 4723 is used by Appium Server. Appium Server will interpret code and it performs necessary
actions on AVD or real device.

Npm – Node Package Manager

Step 1: Launch cmd using Administration mode. Go to “Start”, type cmd and Click on “Run as
administrator”

Step 2: Type below command

npm install -g appium

Step 3: type “appium” on command line

28
Download APK demo app

Google search for “appium api demos apk download”.

https://github.com/appium/appium/blob/master/sample-code/apps/ApiDemos-debug.apk

download it

User should install this APK on Android Virtual Device by executing below steps :

Step 1: Navigate to folder “C:\Users\<Username>\AppData\Local\Android\Sdk\platform-tools” and


copy API Demo APK file in this folder

Step 2: Create “Run.bat” file in the same folder, write “cmd” word in this file and save it

Step 3: Double click on “Run.bat” file – This will open command prompt

Step 4: Type command and press enter key: adb install <apk_file>

Install Eclipse Editor

Google search for “download eclipse ide for java developers for windows”.

Note - Download Eclipse IDE for Java Developers which has essential tool – Maven

URL : https://www.eclipse.org/downloads/packages/release/juno/sr2/eclipse-ide-java-developers

Download it.
29
Write first java program which will print “Hello” word

Setup Maven Project with Appium Dependencies


Java related packages hosted on Maven.

Appium supported language - https://github.com/appium/appium/tree/master/sample-code

Maven Repository - https://mvnrepository.com/

Appium compatibility with selenium - https://github.com/appium/java-client

<dependencies>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-
java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>

Understanding the Desired Capabilities to setup the


Environment in the Appium
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.remote.MobileBrowserType;
import io.appium.java_client.remote.MobileCapabilityType;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;

public class MyFirstProgram {

public static void main(String[] args) throws MalformedURLException {


// TODO Auto-generated method stub
File appDir = new File("src");
File app = new File(appDir,"ApiDemos.apk");

30
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Sid_Nexus_5X");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
cap.setCapability(MobileCapabilityType.AUTOMATION_NAME,
"uiautomator2");

AndroidDriver<AndroidElement> driver=new AndroidDriver<>(new


URL("http://127.0.0.1:4723/wd/hub"), cap);

Appium first program to invoke the Android Apps

The following diagram is an overview of how the components of POM interact with the components
of products such as.

31

You might also like