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

3 comments:

  1. Replies
    1. Great Article
      android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. You might comment on the order system of the blog. You should chat it's splendid. Your blog audit would swell up your visitors. I was very pleased to find this site.I wanted to thank you for this great read!! Laptop Repair Dubai

    ReplyDelete