DialNumber automation using Appium and Selenium for Android.
package com.flipkart;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;
public class DialNumber {
static AndroidDriver dr;
@Test
public static void dialNum() throws MalformedURLException
{
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability("deviceName", "Moto G(2nd Generation)");
cap.setCapability("PlatformVersion", "5.1.1");
cap.setCapability("PlatformName", "Android");
cap.setCapability("appPackage", "com.android.dialer");
cap.setCapability("appActivity", "com.android.dialer.DialtactsActivity");
dr=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap);
dr.findElement(By.id("com.android.dialer:id/floating_action_button")).click();
dr.findElement(By.id("com.android.dialer:id/zero")).click();
dr.findElement(By.id("com.android.dialer:id/eight")).click();
dr.findElement(By.id("com.android.dialer:id/nine")).click();
dr.findElement(By.id("com.android.dialer:id/zero")).click();
dr.findElement(By.id("com.android.dialer:id/four")).click();
dr.findElement(By.id("com.android.dialer:id/five")).click();
dr.findElement(By.id("com.android.dialer:id/zero")).click();
dr.findElement(By.id("com.android.dialer:id/five")).click();
dr.findElement(By.id("com.android.dialer:id/five")).click();
dr.findElement(By.id("com.android.dialer:id/two")).click();
dr.findElement(By.id("com.android.dialer:id/nine")).click();
dr.findElement(By.id("com.android.dialer:id/dialpad_floating_action_button")).click();
dr.findElement(By.id("com.motorola.android.providers.userpreferredsim:id/msim_always_ask_sim_button_background")).click();
}}
0 comments:
Post a Comment