MainMenu

Home Java Overview Maven Tutorials

Saturday, 24 June 2017

Appium Example Calling Numer from Andriod



For Video Tutorial : Move on Youtube Channel


Note : Select the playlist as per your need & move with number sequence


Hello Friends,
In this session, we will discuss that how to automate Andriod "Native" application Like Dialer.


For Video :- Click Here



Here is the Sample code :


import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
public class Nativeapp
{
public static AndroidDriver driver;
public static void main(String[] args) throws MalformedURLException
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "LYF");
capabilities.setCapability(MobileCapabilityType.VERSION, "6.0.1");
capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Andriod");
capabilities.setCapability("appPackage", "com.android.dialer");
capabilities.setCapability("appActivity", "com.android.dialer.DialtactsActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.id("Call Csc Idea")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.quit();
}
}
Code Description :- As usual you have to create desired capability object & then set capabilities for device version, name, platform etc.
After that you must set the capability for app package and app activity.

How to find app package & app activity


Now you have to locate your number/contact to make a call
Now run the code & verify that you application is launched.







Tags :

How to automate Andriod Dialer

Code to automate andriod Native application

Appium tutorial to automate Calling Number

Appium tutorial to automate already installed app

No comments:

Post a Comment