title: iOS Swift UI Test tap alert button
body: <p>A really small UI test fails when trying to tap an alert button, what step am I missing?</p>
  
  <p>I'm trying to tap the "Continue" button in the alert displayed below with the following code (that I get from <a href="https://developer.apple.com/library/archive/documentation/ToolsLanguages/Conceptual/Xcode_Overview/RecordingUITests.html" rel="nofollow noreferrer">recording my steps</a>).</p>
  
  <pre><code>let app = XCUIApplication()
  let salesforceloginbuttonButton = app.buttons["salesforceLoginButton"]
  salesforceloginbuttonButton.tap()
  
  let posWantsToUseSalesforceComToSignInAlert = app.alerts["“POS” Wants to Use “salesforce.com” to Sign In"]
  let continueButton = posWantsToUseSalesforceComToSignInAlert.buttons["Continue"]
  continueButton.tap()
  </code></pre>
  
  <p>When I run the test it fails at the last line (i.e: <code>continueButton.tap()</code>) with the error <code>No matches found for Find: Descendants matching type Alert from input</code>.</p>
  
  <p>Notes:</p>
  
  <ul>
  <li>I already tried waiting a few seconds before tapping the continue button with the same result. </li>
  <li>When the test is ran, the app launches and the alert gets displayed after tapping the <code>salesforceloginbuttonButton</code></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/N0lLM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N0lLM.png" alt="Salesforce Login Alert"></a></p>