Let's see how we can automate mobile UI using python uiautomator module. It works on Android 4.1 + .
Install python 2.7 on your system.First you need to install uiautomator package
1. How to Automate call functionality using uiautomator.
This is how you identify the element from uiautomator. You have to pick the unique properties like className,packageName,Text,resourceId etc. by using uiautomator.
from uiautomator import device as d from uiautomator import Device from time import sleep import os
def VoLTE_call(): print("Inside Call Method.") call = d(className='android.widget.TextView', packageName='com.cyanogenmod.trebuchet', text ='Phone').click() sleep(2) dialer = d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/ floating_action_button').click() sleep(1) dialling_page = d(className='android.widget.EditText', packageName='com.android.dialer', resourceId='com.android.dialer:id/digits') .set_text(number) sleep(1) press_call_button = d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/ dialpad_floating_action_button').click() sleep(5) #hold call hold = d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/holdButton') .click() sleep(5) #unhold Call unhold = d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/holdButton') .click() sleep(5) # mute Call mute= d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/muteButton').click() sleep(5) #unmute call unmute= d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/muteButton').click() sleep(5) #speaker on speaker_on= d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/audioButton').click() sleep(5) # speaker off speaker_off = d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/audioButton').click() sleep(5) press_endcall_button = d(className='android.widget.ImageButton', packageName='com.android.dialer', resourceId='com.android.dialer:id/ floating_end_call_action_button').click() d.press.home() #Call The main Method VoLTE_call() print(""Your test is completed...")