Invoke app in real android device using APPIUM and Python

Versions used while doing this blog post,
Appium server version : 1.16.0
Appium Python client version : 0.48

As we know, Appium is capable of automating Web, native and hybrid apps in android. In this post, lets see how we can invoke an app in android. The APK file of the app is in executors machine.

Before getting into actual coding, lets get the steps to be followed to make any appium program functional:
1. We need the latest appium python client and latest stable selenium to be referred into the project library

2. The first step of the program should be setting up of desired capabilities. Here we need to provide the details of the android device with which we are gonna interact and app that is to be installed & invoked.
The mandatory parameters here are:
a. deviceName
b. app [As, we have the apk file in PC from which we execute the program]

3. Creation of android driver by passing appium server URL and device capabilities

4. Only done with execution of expected functionality, the session should be closed/quit

import os

from appium import webdriver

desired_caps = {
    'platformName': 'Android',
    'deviceName': '****',
    'app': os.path.abspath(
        os.path.join('BasePath', 'ApiDemos-debug.apk'))
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

driver.quit()

Leave a Reply

Your email address will not be published. Required fields are marked *