Showing posts from August, 2015

Start & Stop Appium Server Programmatically using Java (MAC OSX)

Appium is widely used for mobile automation these days. You have to have your Appium server up and running before you can run your automated Appium tests. Most of the times, the test engineers ensure that the Appium server is running before they start executing the test suite. But this arrangement won’t work if you want to run your Appium tests in Continuous Integration/Deployment.

In this post, we will see how to start & stop Appium server programmatically using Java. This code is for Mac OSX (10.10). In next article we will see how to start & stop Appium server programmatically using Java on windows.

So here is the code Create a class called AppiumServer and paste the code mentioned below
Loaded using
In your test class, before you set driver capabilities, start the Appium server like the following

Appiumserver server=new Appiumserver(); 
System.out.println("---- Starting Appium server ----"); 

Install & Setup Android SDK and ADB on Mac OSX

We have already seen how to install and configure Android SDK on windows. In this post we will see how to install and configure Android SDK and ADB on Mac OSX. We are using Yosemite (Mac OSX 10.10) while writing this post.
Go to and download “STAND_ALONE SDK TOOLS”  The downloaded file will be a zip file with name like “” (NOTE: version number could be different based on when you are downloading) Unzip the downloaded file and rename it with something shorter, say “android-sdk”Move the “android-sdk” directory to a location of your choiceThe Android SDK archive initially contains only the basic SDK tools. It does not contain an Android platform or any third-party libraries. We need to download them.To download the necessary filesStart your terminalNavigate to the location where you have your android-sdk folder (#5 above)Navigate to tools folderWrite “android” and hit returnAndroid SDK manager will s…

Sending keyboard input via ADB to your android device

Say you are writing an Appium test for Android and you are required to interact with native Android keyboard. Let’s take a test scenario
Launch the applicationTap on the Search bar/box/buttonEnter the search termTap on Enter key on native Android keyboard. How would you do this? We will focus on the last action of tapping “Enter” key on Android keyboard.
It could be simply done by using something called “SendKeyEvent”

Now, how do you know about the key you want to pass to “SendKeyEvent”? Below is the list (table) of keys for your reference.

To verify that it works in your script, you can check them using ADB. Assuming you have your Android SDK properly installed and configured, you can do the following.
Open command prompt (on windows)Use command “adb devices” to make sure that the devices you want to interact with is available in the list returned by adbThen you can endter “adb shell input keyevent <keycode>” use <keycode> from the below table as pe…