Created
February 27, 2019 15:10
-
-
Save biwkf/b0ebb9940e6341ed5e588f148b4381a8 to your computer and use it in GitHub Desktop.
Automating deeplinks with Appium on iOS real device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
args.add("-u");
should now beargs.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