And replace them in your appium download location, The location looks as following on my Ubuntu - /home/tarun/node-v0.12.2-linux-x64/lib/node_modules/appium/build/chromedriver/linux

Using Chrome browser on non rooted devices -

If you have a non rooted device then chrome would work for only version higher than 33, so if you using a version of chrome lower than 33.0 then upgrade it to higher version. This may be far easier than rooting the device :-) Moreover since chrome browser update automatically on Android hence you would like to test on latest version of chrome browser.

then you may already have adb server up and running and you would have kill it. kill adb from command line as following -

killall -9 adb

How do I find the device version and name -

Couple of examples on other sites set VERSION and deviceName capabilities for android but appium seem to ignore it for android. Any way, these capabilities may be used by Appium in future and can be set as - capabilities.setCapability(CapabilityType.VERSION, “4.4”);

If your device is running 4.4.2 then VERSION is 4.4, if your device is running 5.1.1 then version is 5.1 and so on

With appium version 1.3.7 following message is logged in appium server which indicates that VERSION capability is anyway ignored by appium -

info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version

Back to Appium Tutorial IndexWhile emulators are cheap solutions to run automated tests on mobile device. They can not emulate behavior of real device. if your requirement is to run tests on a mobile chrome browser then you are better off using android device since chrome browser can not be installed on emulator.

Following configurations are required to be able to run tests on mobile device -

Download appropriate version of chrome browser on your device

Enable to Developer Mode on device. For ex, to enable developer mode on moto-4.4.4 do following -

Tap

Tap Settings

Tap About phone

Tap the Build number field 7 times

You will begin seeing a message as you approach the 7 touches

Tap the back arrow once complete, and Developer options will now appear under Settings. Once the developer options are enabled under settings in Moto G, it will be there permanently. Hence it is not necessary to repeat these procedures again.You can also disable the developers options if you want.

Once you tap developer options under settings, you can drag it to left to disable the options.

Note: When you connect a device running Android 4.2.2 or higher to your computer, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog. This requires that you have adb version 1.0.31 (available with SDK Platform-tools r16.0.1 and higher) in order to debug on a device running Android 4.2.2 or higher. (if you don’t see this option and after enabling “USB debugging”, and command “adb devices” list your device(s) then check or uncheck “USB debugging” a few time, this how it worked for me :-))

When plugged in over USB, you can verify that your device is connected by executing adb devices from your SDK platform-tools/ directory. If connected, you'll see the device name listed as a "device."

DON’T install node js using above method, it would result in following error when starting appium -

error: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. If you had to install Appium using `sudo npm install -g appium`, the solution is to reinstall Node using a method (Homebrew, for example) that doesn't require sudo to install global npm packages.

Unpack the .zip file you've downloaded. The SDK files are downloaded separately to a user-specified directory

By default, Android SDK does not include everything required to start development. The SDK separates tools, platforms, and other components into packages that can be downloaded as needed using the Android SDK Manager. Hence we must first download a few packages and add to Android SDK.

Execute following command to install adb on Ubuntu -sudo apt-get install android-tools-adband following for mac -

brew install android-platform-tools

Android Debug Bridge (adb) is a command line tool that lets you communicate with an emulator or android device. It is a client-server program and includes three components:

A client, which runs on development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients. For example if you want to see list of emulator/devices running then execute following command -

adb devices

A server, which runs as a background process on development machine. The server manages communication between the client and the adb daemon running on an emulator or device.

A daemon, which runs as a background process on each emulator or device instance.

You can find the adb tool in <sdk>/platform-tools/ directory. It is available on following directory on my linux - /home/tarun/Documents/mine/lib/android-sdk-linux/platform-toolsAppium Inspector

If you installed appium on OSX or Windows using appium binary then you can use appium inspector to inspect to inspect app. Appium inspector has two functions -

Inspect elements in app

Enable record and playback

Appium inspector does not work very well with android. Appium encourages to use uiautomatorviewer. An inspector tool from Google which is same as Appium inspector. You can find information on this here

Before using UIAutomatorViewer you should shut down appium as appium uses UIAutomatorViewer internally and this will prevent UIAutomatorViewer from working.

Once you have android SDK installed then you can start UIAutomatorViewer from command line -

uiautomatorviewer

This would start UiAutomatorViewer as -

Now open the app (for example calculator) in emulator or device and click on Device Screenshot (uiautomator dump) in the UIAutomatorViewer menu.

Following this you would see the snapshot of application in UIAutomatorViewer as -

Now you can analyze the app element by hovering mouse on them. Mousehover would highlight the element in red circle in UIAutomatorViewer and would detail down the hierarchy in RHS.

Appium (to be more precise Appium Server) is a web server which exposes a REST API. It performs following operations -

Receives connections from a client,

Listens for commands,

Executes those commands on a mobile device,

Responds with an HTTP response representing the result of the command execution.

Since Appium uses client server architecture, we can write our test code in any language that has a http client API, though it is easier to use one of the Appium client libraries. Appium server can be on a different machine than the one running test.

Session

Automation is performed in the context of a session. Clients initiate a session with a server specific to each library, but they all eventually send a POST /session request to the server, with a JSON object known as 'desired capabilities' object. At this point the server will start up the automation session and respond with a session ID which is used for sending further commands.

Desired Capabilities

Desired capabilities are a set of keys and values (like a map) sent to the Appium server. Desired capabilities tell server what kind of automation session should be started. Capabilities doc lists the capabilities available for Appium.

Appium Server

Appium is a server written in Node.js. It can be built and installed from source or installed directly from NPM.

Appium Clients

Appium client libraries support Appium's extensions to the WebDriver protocol. When using Appium, Appium client libraries should be used instead of regular WebDriver client.

Appium.app and Appium.exe are GUI wrappers around the Appium server. Appium.app is for mac and Appium.exe is for window. These are bundled with everything required to run the Appium server, hence you need not worry about node. They also have element inspection capabilities, which lets you check the hierarchy of app. This facilitates writing tests. Unfortunately .app is not available for Ubuntu

Application under test should not have to be modified to be able to run automated tests

Automated tests should not be tied to one framework or programming language

A mobile automation framework shouldn't reinvent the wheel when it comes to automation APIs.

A mobile automation framework should be open source, in spirit and practice as well as in name!

Appium meets its philosophy in following ways -

Appium satisfies its first Philosophy by using vendor-provided automation frameworks to control device. Hence Appium-specific or third-party code or frameworks do not have to be compiled with app under test. Appium describes it as - you're testing the same app you're shipping. The vendor-provided frameworks Appium uses are:

Appium satisfies its second philosophy by wrapping the vendor-provided frameworks in one API, the WebDriver API. WebDriver specifies JSON Wire Protocol which is a client-server protocol. Hence a client written in any language can be used to send the appropriate HTTP requests to the server. Webdriver supports clients written in many popular programming languages. Hence you are free to use whichever test framework you want. for example JUnit or Testng with java, NUnit with C#, PHP unit with PHP etc; The client libraries are HTTP clients and can be mixed into your code any way you want. Hence like, WebDriver, Appium is also not a “test frameworks" but rather an "automation libraries". And it is left to you how you want to write tests.

Appium satisfies third philosophy by using WebDriver. Web driver has become the de facto standard for web browsers automation and is a W3C Working Draft. Appium extended the protocol with extra API methods useful for mobile automation.