Download Appium - Perform LongPress Using TouchAction In Android Dialer App - Software Testing Tutorials graphic type that can be scaled to use with the Silhouette Cameo or Cricut. An SVG's size can be increased or decreased without a loss of quality. All of our downloads include an image, Silhouette file, and SVG file. It should be everything you need for your next project. Our SVG files can be used on adhesive vinyl, heat transfer and t-shirt vinyl, or any other cutting surface
Create And Run Android Appium LongPress Test
DialPad.java
package Android;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class DialPad {
AndroidDriver driver;
@BeforeTest
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "ZX1B32FFXF");
capabilities.setCapability("browserName", "Android");
capabilities.setCapability("platformVersion", "4.4.2");
capabilities.setCapability("platformName", "Android");
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(15, TimeUnit.SECONDS);
}
@Test
public void dial() {
//Click on dial pad button to open dialer pad.
driver.findElementById("com.android.dialer:id/dialpad_button").click();
//Create object of TouchAction class.
TouchAction Action = new TouchAction(driver);
//Create action chain using TouchAction class reference to perform long press action on button 0 of dialer pad.
Action.longPress(driver.findElement(By.name("0"))).perform();
//Get the result from dial text box.
String result = driver.findElementById("com.android.dialer:id/digits").getText();
//Compare actual and expected result using testng assertion.
Assert.assertEquals(result, "+", "Actual value is : "+ result+ " did not match with expected value: +");
}
@AfterClass
public void tearDown() {
driver.quit();
}
}- First It will launch dialler pad app using given package and activity name.
- Open dialler pad by clicking on dial pad button.
- Action.longPress method Is used to press and hold 0 button on dial pad.
- Next statement will get text from dial text box.
- Used testng assertion Assert.assertEquals to compare actual and expected result. You can learn more about testng and It's assertions on THIS PAGE.
Download Appium - Perform LongPress Using TouchAction In Android Dialer App - Software Testing Tutorials All SVG file downloads also come bundled with DXF, PNG, and EPS file formats. All designs come with a small business commercial license. These SVG cut files are great for use with Silhouette Cameo or Cricut and other Machine Tools.


