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);