Appium – Safari iOS sample

Currently Appium support Safari on iOS device up to version 9.3. This topic will be describe how to setup it and run a sample scripts.

Requirements:

  1. MAC machine has installed appium, java environment and XCode, w/Command line tool.

Get Safari Launcher xCode project at: https://github.com/budhash/SafariLauncherpicture1

1.       Create SafariLauncher.ipa file

  • Step1:  Open terminal and type $xcodebuild –showsdks to check iOS SDK versionpicture2
  • Step2: Open terminal and go to the project folder then type command to build app   like screenshot below:picture3

2. Setup iOS device

  • go to Settings > Developer > Enable UI Automation

    3. Start Appium server

    picture6

4. Sample script to run on Safari iOS


public class Safari_iOS {
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
 capabilities.setCapability("bundleId", "com.safariLauncher.safariLauncher");
 capabilities.setCapability("deviceName", "iPhone 5");
 capabilities.setCapability("platformName", "iOS");
 capabilities.setCapability("platformVersion", "9.3");
 capabilities.setCapability("browserName", "Safari");
 IOSDriver driver = new IOSDriver (new URL("http://0.0.0.0:4723/wd/hub"),capabilities);
 driver.get("https://google.com");
 driver.rotate(ScreenOrientation.LANDSCAPE);
 driver.quit();
}
}

Hope this help !!!

Advertisements

One thought on “Appium – Safari iOS sample

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s