iOS | Use deep links
With regard to using the public web, deep linking uses a hyperlink that links to a specific piece of web content on a website (such as http://directaccount.chickenshack.com) rather than the website's home page (such as http://www.chickenshack.com). The URL contains all the information needed to point to a particular item inside that site.
Deep links are becoming more and more useful. For iOS, you need to ensure that the coding in your test is correct. Otherwise, nothing will happen.
To run a deep link test on iOS, you need to have the following information:
- The Application Identifier
- The URL of your deep link to test on
To access the URL of your deep link, you will need to use a standard driver.get()
command. The following code sample explains how to do this in more detail.
String host = "YourCloudHost.perfectomobile.com";
String myToken = "Put your Security Token Here;
String myAppIdentifier = "com.ios.chickenshack";
String deeplink = "https://extensionurl.chickenshack.com/myAccount/rewardPoints";
String myDeviceUnderTest = "Put Your Device ID Here";
String scriptname = "Put Your Script Name Here";
capabilities.setCapability("securityToken", myToken);
capabilities.setCapability("deviceName", myDUT);
capabilities.setCapability("automationName", "Appium");
capabilities.setCapability("takesScreenshot", true);
// Name of script
capabilities.setCapability("scriptName", scriptname);
// Create Remote WebDriver
System.out.println("Creating Device Test per specified capabilities");
AppiumDriver driver = new AppiumDriver(new URL("https://" + host + "/nexperience/perfectomobile/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(45, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(45, TimeUnit.SECONDS);
PerfectoExecutionContext perfectoExecutionContext = new PerfectoExecutionContext.PerfectoExecutionContextBuilder()
.withProject(new Project("Customer-Recreation", "1.0"))
.withJob(new Job("Deeplink-Recreation", 1)
.withBranch("CodeSample"))
.withContextTags("DevelopersArticle")
.withWebDriver(driver)
.build();
ReportiumClient reportiumClient = new ReportiumClientFactory().createPerfectoReportiumClient(perfectoExecutionContext);
try {
System.out.println("Driver Instantiated");
Map<String, Object> params = new HashMap<>();
reportiumClient.testStart(scriptname, new TestContext("DeviceTest", "CustomerCode", myDeviceUnderTest));
reportiumClient.stepStart("Verify the Home Page");
params.clear();
driver.executeScript("mobile:handset:ready", params);
params.clear();
params.put("content", "Settingst");
params.put("timeout", "30");
driver.executeScript("mobile:text:find", params);
try {
reportiumClient.stepStart("Close the app, To make sure it is not running");
params.clear();
params.put("identifier", myAUT);
driver.executeScript("mobile:application:close", params);
reportiumClient.reportiumAssert("App Was Started and is Now Closed", true);
} catch (Exception a) {
reportiumClient.reportiumAssert("App Was Not Started - Continue", true);
} finally {}
try {
reportiumClient.stepStart("Test the URL Entry");
driver.get(deeplink);
reportiumClient.stepStart("Verify Pop up for App Use");
params.clear();
params.put("content", "Open in");
driver.executeScript("mobile:text:find", params);
reportiumClient.reportiumAssert("Handle Deeplink Popup", true);
// Write code here to handle the pop up if you see it
} catch (Exception e) {
reportiumClient.reportiumAssert("No Safari Pop up - Continue", true);
} finally {}
try {
reportiumClient.stepStart("Verify Log In Page");
params.clear();
params.put("content", "privileges");
params.put("timeout", "30");
driver.executeScript("mobile:text:find", params);
reportiumClient.reportiumAssert("My Account Log In Page Appeared", true);
} catch(Exception e){
reportiumClient.reportiumAssert("Log In Page Did Not Load", false);
} finally {}
Thread.sleep(10000);
System.out.println("Done DEEPLINK Test\n");
Make sure to update the following variables for your host: myToken, myAppIdentifier, deeplink, myDeviceUnderTest, and scriptname. Those variables in the test are generic. You will need to use your own variables, not the ones in this code sample.
For assistance with deep linking for Android, see this article in regards to Android Deep Linking in the cloud lab.
For all other questions regarding deep linking, contact Perfecto Support.