Appium: trigger iOS deep-link

Prerequisites:
appium: 1.6.5
java-client: 5.0.4
iOS simulator: iPhone 6

Opening iOS deep-link using appium for me was as simple as that: just define needed driver capabilities and then invoke driver.get(). Specific capabilities are:


 DesiredCapabilities caps = DesiredCapabilities.iphone(); 
 caps.setCapability(DEVICE_NAME, "iPhone 6"); 
 caps.setCapability(BROWSER_NAME, "");
 caps.setCapability(AUTO_DISMISS_ALERTS, true);
 //some other capabilities

Your deep link must satisfy specific format:

 String deepLink = "application-scheme://host/path?queryvalues";

And now all you need is just to create iOS driver with specified capabilities and navigate to deep link:

 AppiumDriver appiumDriver = new IOSDriver(caps);
 appiumDriver.get(deepLink);

That's basically all you need!

If you ever wonder what kind of magic is happening underneath, it is not too complicated. It is appium-xcuitest-driver which in its turn is using node-simctl wrapper around simctl command line utility. The implementation can be found in https://github.com/appium/node-simctl/blob/b1629c42a01362aba2aa13b0427e264a625120e7/lib/simctl.js. So, the same result can be achieved with

 xcrun simctl openurl  

Deeplinks for ios in Appium are demystified :) and I hope it was helpful for you.

Comments

  1. This does not seems to work for real devices

    ReplyDelete
  2. right, does not work on real devices.

    ReplyDelete

Post a Comment