How to Start Mobile Automation With Appium

How to Start Mobile Automation With Appium

1. What is Appium

Appium is open source mobile automation framework. Appium support automation for native, hybrid and mobile web apps. Appium also support integration support with selenium webdriver, TestNG etc. User can attach real device or virtual device. Appium uses JSON wire protocol to interact with Android and iOS Devices. Tester can write test case code in any programming language like Java, Ruby, Python, c# etc.

2. Benefits of Appium

  • It does not require any extra files or agents to interact with mobile devices or emulator.
  • It provides cross platform supports to if you have done already code for android app. then you can use same code for iOS app.
  • Appium can automate Native, Hybrid and web apps.
  • No extra time require to configure it , Installation is easy and fast.

3. How to write your First Appium program to integrate it with device

 


// Setting and Getting APK path & APK
File path = new File("D:\\yourapk.apk");

// Setting capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();

//capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("device", "Nexus 5");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("udid", "");

capabilities.setCapability("deviceName","Mydevice");
capabilities.setCapability("platformVersion", "21");
capabilities.setCapability("app-package", ""); //Replace with your app's package
capabilities.setCapability("app-activity", ""); //Replace with app's Activity
capabilities.setCapability("app", path.getAbsolutePath());

// Setup driver
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub/"), capabilities);

I have put necessary comments in above code so it is easy to understand. Just tester need to replace actual values according to their APK.

4. How to inspect Element when using appium for mobile app Automation

  • First you need to attach your mobile device or start emulator.
  • After that start your app. screen for which you want to inspect element.
  • Now, Go to your folder Android-sdks->Tools->Click on Uiautomator.bat
  • Now you can easily inspect any element of your mobile app.
No Comments

Sorry, the comment form is closed at this time.