Appium iOS: settings for iOS testing on real device

Last updated on:

The snippet is representing how would you start appium driver back in a days. For future reference please go to Appium section of the blog, here is the most recent version of the code.

package com.something.test;

import io.appium.java_client.remote.HideKeyboardStrategy;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.AppiumDriver;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.HashMap;

 * Test Mobile Driver features
public class MobileDriverIOSTest {

	public WebDriver driver = null;

  public void setup() throws Exception {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1");
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone");
    capabilities.setCapability("udid", "23333fdgsd333333fdgfd3333fgd3333344444444");
    driver = new RemoteWebDriver( new URL(""), capabilities);

  public void tearDown() throws Exception {

  public void firstTest() {
      Tests code goes here

View Comments

Leave a Comment

Use markdown or basic HTML and be nice.