Automating deeplinks with iOS real device

Hi everyone, wasn’t sure where to put this but maybe someone will find it useful.

On a real device it is not possible to simply call driver.get(“url”), doing so will open SIRI and query with “url” often resulting in a search. Instead we can take advantage of Safari’s launch parameters and pass deep link URL as argument.

Below is sample code in Java:

String deepLinkURL = "deeplink://";
//it is necessary to first kill safari 
driver.executeScript("mobile: terminateApp", ImmutableMap.of("bundleId", ""));

List args = new ArrayList();

Map<String, Object> params = new HashMap<>();
params.put("bundleId", "");
params.put("arguments", args);

driver().executeScript("mobile: launchApp", params);


Just a small, but important update to the previous comment.
Key arg “-u” is valid until iOS 12.2.

If you would like you tests be executable on 12.3 and up, replace it with "–U"

1 Like

it doesn’t work for me for any of the arguments “-u” and “-U”, any ideas?

appium log: “Cannot request the screen point at NSPoint:”

do you know what other arguments can be passed to open safari in new tab appium?