Skip to content

Instantly share code, notes, and snippets.

@biwkf
Created February 27, 2019 15:10
Show Gist options
  • Save biwkf/b0ebb9940e6341ed5e588f148b4381a8 to your computer and use it in GitHub Desktop.
Save biwkf/b0ebb9940e6341ed5e588f148b4381a8 to your computer and use it in GitHub Desktop.
Automating deeplinks with Appium on iOS real device
/* On a real device it is not possible to simply call driver.get("url"), doing so will open SIRI and query with "url" resulting in a search.
Instead we can take advantage of Safari's launch parameters and pass deep link URL as argument.
Below is an example: */
String deepLinkURL = "deeplink://";
driver.executeScript("mobile: terminateApp", ImmutableMap.of("bundleId", "com.apple.mobilesafari"));
List args = new ArrayList();
args.add("-u");
args.add(deepLinkURL);
Map<String, Object> params = new HashMap<>();
params.put("bundleId", "com.apple.mobilesafari");
params.put("arguments", args);
driver.executeScript("mobile: launchApp", params);
driver.findElementByAccessibilityId("Open").click();
@PramodKumarYadav
Copy link

The args.add("-u"); should now be args.add("-U");
If not the code will not work. Refer this link: https://discuss.appium.io/t/automating-deeplinks-with-ios-real-device/25352/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment