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;
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;
- XCODE
- Apple developer account must to handle the code signing including provisioning profile
- ideviceinstaller should be installed in Mac for handling the real device
- iTunes required to capture the UDID
- Appium dmg (1.5.3)
- Eclipse IDE (Neon 4.6.0)
- 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
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.