Jumpstart iOS automation using Appium - Part 4

Govinda Raj
June 8, 2020

Click here to read Jumpstart iOS automation using Appium- Part 3


  • Open the appium from launchpad and start the server.
  • Make a maven project in intellij with unique group Id.
  • Add these dependency in pom.xml.
  • Make a class with name SampleTest

import io.appium.java_client.ios.IOSDriver;






import org.openqa.selenium.By;

import org.openqa.selenium.OutputType;

import org.openqa.selenium.TakesScreenshot;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.remote.Augmenter;

import org.openqa.selenium.remote.DesiredCapabilities;

import org.testng.annotations.AfterMethod;

import org.testng.annotations.BeforeMethod;

import org.testng.annotations.Test;

public class SampleTest {

//Ios driver to operate the test

private IOSDriver driver;

//Setting up for the device


public void setUp() throws MalformedURLException {

DesiredCapabilities caps = new DesiredCapabilities();

caps.setCapability("platformName", "iOS");

//Put your device version

caps.setCapability("platformVersion", "7.1");

//put your device name

caps.setCapability("deviceName", "iPhone Simulator");

//Put your device bundle id

caps.setCapability("bundleid", "put your app bundle Id");

//put your app path on which you are going to test

caps.setCapability("app", "path/");

driver = new IOSDriver(new URL(""), caps);


//If you want to test for logIn


public void testiOS() throws InterruptedException, IOException {

driver.findElement(By.xpath("put here username textbox xpath")).sendkeys(“put here username”);

driver.findElement(By.xpath("put here password textbox xpath")).sendkeys(“put here password”);

driver.findElement("put here logIn button identifier")).click();

//Wait for 2 seconds


//Take screenshots after login and save

File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

//Put path where you want to save the screenshot

FileUtils.copyFile(scrFile, new File("path/filename.jpg"));


//Now close the webdriver


public void tearDown() {



  • Build  the test and then execute.
  • Go to location of screenshot file and check whether it is working properly or not.

Reference -

By: Govinda Raj

About Quinbay

Quinbay is a dynamic one stop technology company driven by the passion to disrupt technology today and define the future.
We private label and create digital future tech platforms for you.

Digitized . Automated . Intelligent