Book Image

Appium Essentials

Book Image

Appium Essentials

Overview of this book

Table of Contents (14 chapters)


The idea of mobile automation using the Selenium syntax first came about at the Selenium Conference in April 2012 in London by Dan Cuellar. During the presentation, he showed the automation of iOS using the Selenium syntax. People who attended the conference were excited about the tool's possibilities.

A few months after the Selenium conference, Jason Huggins contacted Dan about his project on mobile automation. Jason encouraged Dan to release his code under an open source license. In August that year, Dan released the source code on GitHub. Jason then decided to introduce the project in Mobile Testing Summit in November 2012, but the project needed a new name first. Thus, the name Appium was born.

Appium is the one of the most popular tools for mobile automation and is used for testing applications on iOS, Android, and Firefox platforms. It can automate native, hybrid, and web mobile apps.

In January 2013, Sauce Labs decided to fully back Appium and created a team to support Appium. The team, which included Jonathan Lipps (the current project lead), decided that Appium needed a rebirth and ultimately settled on Node.js as the framework to be used.

Appium, with its new design, debuted in Google Test Automation Conference 2013 and was released with Android and Selendroid support a few months later, to make Appium the first cross-platform automation framework. In May 2014, Appium released version 1.0 with stability improvements, bug fixes, and added features. If you want to read more about Appium's history then you can visit the official website

This book will help you perform mobile automation testing and use Appium drives on both emulators/simulators and real devices. You will also have a good understanding of mobile automation concepts once you're through with it.

What this book covers

Chapter 1, Appium – Important Conceptual Background, explains the JSON wire protocol and Appium sessions, and you will get to know the "desired capabilities" that are required before you start using Appium. A brief introduction to the Appium server and the client library are also provided in the chapter.

Chapter 2, Getting Started with Appium, explains the system requirements for both Android and iOS platforms and the advantages of using Appium over other existing tools. You will also understand the prerequisites to get started with Appium. In this chapter, you will learn how to install and set up the software with system variables and create the development environment.

Chapter 3, The Appium GUI, explains all the functionalities of the buttons and general settings using the Appium GUI.

Chapter 4, Finding Elements with Different Locators, explains the steps to find elements in order to interact with mobile applications. You will also be acquainted with how to use different locators and techniques to find the elements.

Chapter 5, Working with Appium, explains scriptwriting for different mobile applications that are supported by Appium. You also get to know about how to install mobile apps in an emulator.

Chapter 6, Driving Appium on Real Devices, introduces users to testing mobile applications on real devices. This chapter also includes the general settings required for real devices to work with Appium.

Chapter 7, Advanced User Interactions, explores the Appium client library and mobile gestures, such as scroll, zoom, and swipe. You will also learn how to capture screenshots and the uses of the TestNG Listener for taking screenshots on test failure.

What you need for this book

You will need the following software to get started with the examples in this book:

  • Java (version 7 or later)

  • The Android SDK API Version 17 or later

  • The Eclipse IDE

  • TestNG

  • The Appium Server

  • The Appium client library (Java)

  • The Selenium Server and WebDriver Java library

  • The ADB plugin on Chrome browser

  • Windows 7 or later

  • Mac OS 10.7 or later

  • Xcode (4.6.3 or a later version; 5.1 is recommended)

Who this book is for

Appium Essentials is intended for automation testers and developers who want to enhance their skills in web-based automation as well as mobile application automation using Appium. It is assumed that you have basic knowledge of mobile application testing, Selenium WebDriver, and programming.


In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "After installation, run the command appium-doctor to ensure that we are ready with Appium."

A block of code is set as follows:

public void setUp() throws MalformedURLException{
  //Set up desired capabilities
  DesiredCapabilities caps = new DesiredCapabilities();
  File app=new File("path of the apk");
  caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "4.4");
  caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
  caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Android emulator");
  caps.setCapability("avd","Name of the AVD to launch");
  caps.setCapability(MobileCapabilityType.APP_PACKAGE, "package name of your app (you can get it from apk info app)");
  caps.setCapability(MobileCapabilityType.APP_ACTIVITY, "Launch activity of your app (you can get it from apk info app)");
  caps.setCapability(MobileCapabilityType.BROWSER_NAME, "Browser");
  // In case of web-apps
  driver = new AndroidDriver (new URL(""), caps);

Any command-line input or output is written as follows:

android create avd –n <name of the AVD> -t <targetID>

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on Advanced system settings."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.