xctest – ios deep hyperlink testing


I am attempting to check deep linking of my app utilizing iOS XCTests. To take action I’ve used the code detailed in a number of webs:

    let safari = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari")
    safari.launch()
    safari.textFields["Address"].faucet()
    safari.textFields["Address"].typeText("https://web-to-test-deep-link")
    safari.keyboards.buttons["Go"].faucet()

With this code:

  • Safari opens (okay)
  • My web site is written within the deal with bar (okay)
  • The Go button is pressed (okay)
  • Then, above Safari it seems the Open with app banner. This banner mentions MyApp, a textual content saying “Open within the MyApp app” and the OPEN button”.

Then I’ve tried so as to add the code to click on on this button so my app is open, however I can not do it.
I’ve tried:

safari.buttons["Open"].faucet()

with out success, the open button shouldn’t be discovered and the take a look at fails.

I’ve used the Accessibility inspector and taking into consideration the attributes of this banner I’ve tried this:

safari.buttons["MyApp, Open in the MyApp app, OPEN"].faucet()

with out success too.

How might I do know the code to click on on this banner and open my app with the deep hyperlink?

See also  ios - Module iCloudStorage requires principal queue setup because it overrides `constantsToExport`

Leave a Reply