Saturday, January 13, 2018

Appium Setup


Mobile Automation with Appium
  1. Android SDK
  2. Android Device (configuration)
  3. Eclipse / Java
  4. Appium


Setting up Android SDK

Step 2: Scroll to “Get just the command line tools”  
(* You can download Android Studio also instead of SDK Tools but for testing SDK tools is sufficient)
Step 3: Download SDK Tools for respective platform

Step 4: Extract download zip
Step 5: Open “cmd” and navigate to the tools folder in SDK.
Step 6: commands
  1. Sdkmanager.bat --list
  2. Sdkmanager.bat platforms;android-26
  3. Sdkmanager.bat build-tools;26.0.3
  4. sdkmanager.bat platform-tools


Step 7: set environment variable.

  1. ANDROID_HOME    =    path to sdk folder
  2. PATH  $ANDROID_HOME/build-tools/25.0.2;$ANDROID_HOME/platform-tools;$ANDROID_HOME/tools;

* Note - Update path according your installation
Step 8. Close all CMD and start again. Execute adb device command. If you get error for adb then check installation.


Device Set Up configuration:
  1. Enable developer option
  2. Enable usb debugging
  3. Connect device to computer via usb and check “adb devices” shows device connected.

Appium Set Up
  1. Download and Install Node.js https://nodejs.org/en/
  2. Open Node Js command prompt and execute below command
    1. npm install appium -g
  3. Verify appium installed with below command
    1. appium -v




Locating elements for native app -

Locating Android elements - Id, Xpath

IOS - Name, Xpath

Automating already existing App using Appium.

Step 1:Get package name and activity from the Application.
I. Start app. Launch screen
Ii. Execute below 2 commands

adb shell
dumpsys window windows

Search for ‘mCurrentFocus=’  Get the package name /activity name (check snap)

Package name: com.android.settings
Activity name:com.android.settings.settings

Step 2.
Set both to desired capabilities

DesiredCapabilities capabilities=new DesiredCapabilities();
   capabilities.setCapability("deviceName", "Your device Name");
   capabilities.setCapability("appPackage", "com.android.settings");
   capabilities.setCapability("appActivity", "com.android.settings.Settings");
That’s all you need…Now you can create driver instance and use it for automation.

No comments:

Post a Comment