Wednesday, November 22, 2017

adb devices not showing the Android device

Connect your android device
Go to Settings->About Phone/Device -> Tap on the build number 7 times
you will go to developer mode.
Just above the option About device you will find "Developer Options" setting. tap on that.
Enable USB debugging.
It would ask for a confirmation of RSA fingerprint. Click on Ok.

Now go to terminal/command prompt and run the command "adb devices"
Your device will be listed with device id.

In the android capabilities in your code you can use the above device id as udid 
Ex: udid=c55c70af04399e58

Tuesday, November 7, 2017

Enabling Keyboard input in Android Emulator

Open Android Studio.
Open AVD Manager.
Click on Edit for the device which you want to have keyboard input.
Click on Show Advanced Settings. 
At last there is a option called "Enable Keyboard Input"

Enable that.. Save and start the emulator. Now you can use your keyboard with emulator.

Monday, November 6, 2017

Emulator Proxy Settings - Android Studio

With the emulator open, click More , and then click Settings and Proxy. From here, you can define your own HTTP proxy settings.

Refer to the below Image.

Give the proxy URl and port number and also if authorization required give those details. apply.

now open browser in emulator and check.

It worked for me. Hope it will help others too :)

Thursday, November 2, 2017

Steps to Automate LinkedIn Android app[Package+activity+capabilities]

1) install Appium + Node

2) Install Android Studio as well and create a virtual device on that i have created with name : Nexus_5X_API_25_1

3) Download LinkedIn.apk file from below link.

4) Now For automating any android app we need to know the package and activity names.
So Lets find them.

For this set your PATH variable to point to below directories.

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/build-tools/26.0.2

above version can be anything in my case it is 26.0.2

after setting the above path variables run the below command.

aapt dump badging “<Path to LinkedIn.apk>” 

Output of above command will contain below 2 values.

package: name=''
launchable-activity: name=‘'

5) So we got the package name and activity name too. Now we should frame the desired capabilities section. Like this(In my machine)

  "platformName": "Android",
  "deviceName": "Android Emulator",
  "app": "/Users/sriramkukkadapu/Downloads/LinkedIn.apk",
  "automationName": "Appium",
  "platformVersion": "7.1.1",
  "appPackage": "",
  "appActivity": "",
  "avd": "Nexus_5X_API_25_1”

6) Now start appium with above capabilities and you can see it will open the app :)

Assuming my appium/node server is running on url :
You can check the status of the server with this url

Note: IP and the port number values would be the one which we give, when we start the node/appium server


public class AndroidDriverEx {
public static void main(String args[]) throws IOException, InterruptedException
    WebDriver driver=null;
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("deviceName","Android Emulator");
    capabilities.setCapability("app", "/Users/sriramkukkadapu/Downloads/LinkedIn.apk");
    driver=new AndroidDriver(new URL(""), capabilities);

Now we are good to go and automate all the actions which you wanted to automate.

Sunday, October 22, 2017

Installing Appium + Node - Mac

Following steps worked for me[On Mac OS]. 

Mac OS : 10.11.6 OS X EI Capitan
Xcode : 8.1
Appium : 1.6.0
Appium GUI : 1.2.3 dmg
npm : 5.4.2(after upgrade)
node: 6.3.0

Prior to this you need to have XCode[for iOS] and Android Studio[for Android] installed in your machine.

For Appium we need to install Node JS and also carthage.

1)  Install Node and set proxy for node.

Download and install this node pkg. It will install npm too.

If your machine is behind a proxy then Set Proxy using below commands

npm set proxy http://<proxy url>:<port>
npm set https.proxy https://<proxy url>:<port>

Set No proxy variable.
export no_proxy=localhost,
export http_proxy=http://<proxy url>:<port>

2)  Install carthage

3) we need to upgrade the node version and the install appium.

Upgrading npm
sudo npm install npm@latest -g

Set All Proxy and then install appium because it downloads using curl
export ALL_PROXY=<proxy url without http>:<port>
export no_proxy=localhost,
export http_proxy=http://<proxy url>:<port>

npm set proxy http://<proxy url>:<port>
npm set https.proxy https://<proxy url>:<port>

npm install appium@1.6.0

It will take some 10 min time for installing.

Once the installation is successful. verify appium directory inside node.


Install appium-doctor
npm install appium-doctor

npm install appium-doctor –g

after it is done type this command. it will show us if anything is wrong.

If it shows JAVA_HOME bin is not set properly then run this commands or set JAVA bin path.

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin

5) To authorize npm for iOS

npm install -g authorize-ios appium-doctor appium-gulp-plugins authorize-ios

6)  Install appium 1.2.4 dmg file. This is for appium GUI

Before starting Appium server make sure Xcode is pointed to right path.
sudo xcode-select -switch /Applications/

If Xcode is not set properly errors might come.

In the appium you need to specify the capabilities for appium server to start. I am listing the capabilities which i have used, for iOS and Android apps. modify them accordingly and point appium to your mobile app with "app" : <path> parameter

Once the capabilities are defined(for any deivce ex: iOS or Android)

Open appium(GUI). Click on Start Inspector Session.
Select the configuration(any of the capabilities below) and
Click on Start Session.

Capabilities are below for iOS

  "platformName": "iOS",
  "deviceName": "iPhone 7",
  "app": "/Users/sriramkukkadapu/",
  "automationName": “XCUITest”

Capabilities for Android

  "platformName": "Android",
  "deviceName": "Android Emulator",
  "app": "/Users/sriramkukkadapu/TestAPP.apk",
  "automationName": "Appium",
  "platformVersion": "7.1.1",
  "appPackage": "<app package>",
  "appActivity": “<app activity>”
 "avd": "Nexus_5X_API_25_1"

If we dont specify avd prameter
For Android devices(if it says cannot recognize any devices)
then open android studio start any device
and run this command to check the device status. Android_HOME/platform-tools has this command

adb devices

once device is listed and active it will be recognized by appium.

7) To see the list of Android virtual devices.
emulator -list-avds

my mac has below devices


use the same name in capabilities as avd name


For Android we all know that .apk is the setup file(which will be used to run the application)
For iOS .ipa is the file which user will be able to install the application but to generate a .ipa file apple license is required so there is a separate .app file which XCode tool generates for us to install it on the virtual device and run the application.

So to run the .apk file we need android studio [Emulator]
to run the .app file we need xcode [Simulator]

Tuesday, October 10, 2017

Setting up Android studio and running a apk file in Emulator in Mac

These steps are for Mac machine.

Installing Android Studio

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/
export PATH=$PATH:$JAVA_HOME/bin/
Verify like this : $JAVA_HOME/bin/java -version

export GRADLE_USER_HOME=/scratch/skukkada/OMC_Softwares/gradle-2.14.1/
export PATH=$PATH:/scratch/skukkada/OMC_Softwares/gradle-2.14.1/bin

For Mac, download android-studio(which is a dmg file supported for mac)
open the dmg file and drag dmg into applications. it will show Android-Studio in “Finder” or "Launchpad"
open android studio, click next, select default sdk path click on next..
it would ask for proxy give the proxy details(if you are behind a proxy)

http, host='<proxy url>' port=<port> --proxy=http "platforms;android-25”
enable https also

Click next.. Downloading of the components will start.
It will take lot of time even after connecting to lan.

once the android studio opens, go to SDK manager and in Platform, select version from 7,6,5(all) and update. in SDK tools we need emulator. download these packages.

(Not Required) Setting path for Android home
   export ANDROID_HOME=/Applications/ADT/sdk
   export PATH=$PATH:$ANDROID_HOME/bin

For Mac
Android studio automatically sets Android_Home to : /Users/sriramkukkadapu/Library/Android/sdk

if it is not set you can run: export ANDROID_HOME=$HOME/Library/Android/sdk

Installation is done. Now we need to create a AVD(Android Virtual Device or Emulator)

AVD Manager (Or) Emulator

First set these env variables. In Terminal


Go to Android Studio-> AVD Manager -> create virtual device.
Click Next(device selection)
In the System image. install all the android version images(click download link in each of them and download the packages)
Install 8,7 versions

Once the device is ready, 
Open Emulator

we need to install the apk file of the application which you want to run in Emulator
In the mac terminal go to the path where .apk file is present and run this command.

adb install <testapp.apk>

This command will install the application in the emulator(which is currently running).

Sunday, October 8, 2017

Windows - Schedule Testng.xml to run automatically without Jenkins

1st create a batch file to run Testng.xml automatically.
For Maven project the batch file looks similar to below. If your project is not a maven project(you need to specify the path of the libs explicitly)

set projectLocation=<C:\SVN-IndirectWorkspace\...>
cd %projectLocation%
mvn clean test -DsuiteXmlFile=<Path of testng.xml>

Ex(Maven Project):

set projectLocation=C:\SVN-IndirectWorkspace\TestProj\
cd %projectLocation%
mvn clean test -DsuiteXmlFile=testng.xml

Ex(Normal Project):

set projectLocation=C:\GitRapo\MyProject
cd C:\GitRapo\MyProject
set classpath=C:\GitRapo\MyProject\bin;C:\GitRapo\MyProject\lib\*
java org.testng.TestNG C:\GitRapo\MyProject\testng.xml

Test the bat file once by executing it.

Now we can create a Windows Task to run this batch file on the desired time(Daily/weekly etc).

Follow the steps in this blog post: