How to handle real iPhone device in Appium Automation capabilities?

I want to run my Appium+Core Java+TestNG based test script in iPhone device instead of the Simulator. If you are not familiar in setting up the Appium in Mac, please find the below URL for your reference;

https://gopekannan.wordpress.com/2015/08/31/how-to-setup-and-automate-ios-mobile-application-using-appium-in-mac/

I have tried in Mac OS X EI Captan(10.11.6) and XCODE(7.3.1) connected with iPhone 5S – iOS 9.3.4

Pre-requisties;

  1. XCODE
  2. Apple developer account must to handle the code signing including provisioning profile
  3. ideviceinstaller should be installed in Mac for handling the real device
  4. iTunes required to capture the UDID
  5. Appium dmg (1.5.3)
  6. Eclipse IDE (Neon 4.6.0)
  7. JDK 1.8

ideviceinstaller should be downloaded and installed based on the below URL;

http://macappstore.org/ideviceinstaller/

1 Press Command+Space and type Terminal and press enter/return key.

2 Run in Terminal app:

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

< /dev/null 2> /dev/null

and press enter/return key. Wait for the command to finish.

3 Run: brew install ideviceinstaller

Add the below information in the Appium Server IDE and refer the below screenshot for detailed information;

  • .APP file path
  • Bundle ID of your projectname.xcodeproj
  • Force device information including the version
  • UDID of your device, which was captured through iTunes

Screen Shot 2016-08-07 at 1.53.10 PM

If you want to handle the device information in the coding part itself instead of the Appium Server configuration section, please refer the below coding information;

@BeforeTest

public void setUp() throws MalformedURLException

{

DesiredCapabilities caps = new DesiredCapabilities();

caps.setCapability(“platformName”, “iOS”);

caps.setCapability(“platformVersion”, “9.3”);

caps.setCapability(“deviceName”, “Gopi’s iPhone”);

caps.setCapability(“udid”, “201c3636337576576586867867969”);

caps.setCapability(“bundleid”, “com.example.apple-samplecode.UICatalog”);

caps.setCapability(“app”, “/Users/gkannan/Library/Developer/Xcode/DerivedData/UICatalog-ghszamzrhdmuvxfixpmiroxdnkbb/Build/Products/Debug-iphoneos/UICatalog.app”);

}

If you want to compare with the Android capabilities with the iOS device capabilities, apk file path is equivalent to “app” section, android appPackage is equivalent to bundleid section, target device information is mentioned here as udid. Please note iOSDriver will be used in the test script section to handle all the iOS mobile application web elements.

Run the script in Eclipse IDE using the TestNG Test or Suite, your script will be running in the target real device of iPhone or iPad.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s