How to setup Appium Environment for Android Automation?


I am working as SD in Test. I am new to Appium Automation tool , This tool is very tricky to set up environment for me .

I referred following link ::

This link helped me to install Node.js and appium through command line.But I am not sure this right way to do.

I got following message from command line :

mani-kandans-MacBook-Pro:platform-tools manikandan$ info: Welcome to Appium v0.8.2 (REV e9cc66197ad6a3496322bd77a8699509fc761b69)
info: Appium REST http interface listener started on
info – started

After this I don’t have any idea . How to write testcase and run it through Appium?

If your interest to share your knowledge about Appium tool . Please guide me.

  1. How to Install Appium?
  2. How to run testcase through Appium tool?
  • You must to post comments

Part One:-. You appear to have launched the appium server using node server.js
– You can check the server by going to localhost:4723/wd/hub/status in your browser this will return a few details of the server. You have already done this.

The command output will look like this confirming that the server is started:

info: Welcome to Appium v0.8.1 (REV ***********************************)
info: Appium REST http interface listener started on
info - started

Part Two:-. Next you use the selenium RC for Python, Java, or c# or whatever your language choice. I used c# and can provide examples this should be similar for your tests.

To add the selenium to a c# class: using OpenQA.Selenium.Remote;
You pass all your data to a selenium desired capabilities object.
Some custom desired capabilities exist such as:

  • ‘app-package’ this is the app package name such as com.myapp.main,
  • ‘app-activity’ which is the apps main activity to be called which will also launch the app. This is often a splash activity or main activity,
  • ‘wait-activity’ is the activity that Appium will check for once launched, this would be the app-activity but for me it is different if for some tests a new activity is launched than is called,
  • ‘version’ taking the android version,
  • ‘device ID’ taking your attached device or AVD to command and app which will have a local path to the apk you wish to install. This is signed and installed on start-up if a resigned app already exists it will skip this for you.

        DesiredCapabilities caps = new DesiredCapabilities();
    caps.SetCapability("app-package", "com.myapp.test");
    caps.SetCapability("browserName", "");
    caps.SetCapability("device", "Android");
    caps.SetCapability("app-activity", "com.myapp.SplashActivity");
    caps.SetCapability("takesScreenshot", true);
    caps.SetCapability("version", "4.1.2");
    caps.SetCapability("device ID", "uniquedeviceid");
    caps.SetCapability("app", @"C:\path to\app\on\pc\app.apk");

Following the Capabilities you create create a remote web driver object passing the hub url that you’ve used e.g http://localhost:4723/wd/hub and the Desired Capabilities you’ve created.

RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4723/wd/hub/"), caps);

This line uses the ip or host of the Appium server to begin listening for requests.
For me this step signs installs and launches the app on the attached device hopefully this will work for you the same.
This is where the selenium tests you write are connected to the Appium server.

Now using the created driver object you can access the selenium rc commands of which Appium has implemented many alternatives for android testing.
During each of these your Appium server console window should show you if there is any issues.

Output will be colour coded to assist in identifying failures from this window but you can handle these your own way and output to a file if needed.

Update for multiple devices
I am unsure on the use of multiple devices, I would consider selenium grid my previous attempts to add 2 devices to one machine and test had confusion where adb was unable to distinguish regardless of the device id addition to the configuration and commands.
The Appium team have been making improvements to add grid functionality to the server, I recommend you have a look into Appium Grid (link updated)

I apologize for my lack the experience with grid to assist you further.

Regards, Brian

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.