Introduction to Appium

If you have been working on selenium from then you may have come across AndroidWebDriver and Selendroid. Though both of them are limited to only Android devices. AndroidWebDriver has been deprecated in favor of Selendoid. But what if there were a library which can be used for both android and iOS devices or emulators. And this is what appium does. Appium is an open-source library which can be used to automate native, mobile web, and hybrid applications for iOS and Android platforms. Native apps are created using iOS or Android SDKs. Mobile web apps are web apps accessed on a mobile browser. Hybrid apps are hosted inside a native application that utilizes a mobile platform’s WebView.

Appium is a Javascript app that runs in NodeJs; it sits there and just listens for whatever requests it might receive. And then, we already have the Selenium clients who can send in those kinds of web requests, and Appium simply hooks them in.So at its heart, it’s a web server that exposes a Rest API, and uses JSON protocol to communicate between your script, the Appium server, and real or virtual devices.The JSON wire protocol is a transport mechanism that was created by the Selenium webdriver folks. You can interact with it using a REST API. Appium implements the mobile JSON wire protocol, which allows it to control different mobile devices and behaviors over a session. 

Let’s get an example to understand JSON Wire Protocol. You can think of JSON as the telephone power lines that transmit your information. They’re mainly categorized by the verbiage they use like do, get, or post methods, but Appium manages its runs through sessions, and we think of JSON as the infrastructure your code travels down in those sessions.

You can think of a session as a run. Each time the server’s started and a new test case is run, a new session begins. After your test works through your test and flow for your instance, it tears down Appium, your session is finished. 

Appium supports Safari on iOS phone and Chrome or the built-in ‘Browser’ on Android phone. Tests can also be run on Android and iOS emulator, but well emulators are emulators can not replace real device. So if you have real device at your disposal then avoid emulators.It offers cross-platform application testing i.e. single API works for both Android and iOS platform test scripts. It has NO dependency on Mobile device OS. Because, Appium has framework or wrapper that translate Selenium Webdriver commands into UIAutomation (iOS) or UIAutomator (Android) commands depending on the device type not any OS type.Appium supports all languages that have Selenium client libraries like- Java, Objective-C, JavaScript with node.js, PHP, Ruby, Python, C# etc.

Tools required to go for mobile automation :
  1. Android SDK/Studio – Download
  2. Java Development Kit – Download
  3. Eclipse (or other IDE suits you) – Download
  4. Selenium Standalone Jar – Download
  5. TestNG – Download
  6. Appium – Download
  7. Node.js (Optional – Whenever Appium server is installed, it by default comes with “Node.exe” & NPM. It’s included in Current version of Appium.)

In later blog, we’ll see how to install Appium and inspect element via inspector.

You can read my next blog about Appium Architecture.

Advertisements