title: iOS UI Automation deactivateAppForDuration failure
body: <p>I'm working on my first UI Automation script and am encountering a failure at the deactivateAppForDuration line below:</p>
  
  <pre><code>// Verify password field is shown when app is moved to the foreground
  UIALogger.logMessage("move app to background");
  target.deactivateAppForDuration(10);
  UIALogger.logMessage("move app to foreground");
  </code></pre>
  
  <p>The error I get from Instruments is:</p>
  
  <blockquote>
    <p>Script threw an uncaught JavaScript error: Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().switcherScrollView().buttons()["TimeClock"]</p>
  </blockquote>
  
  <p>What I see on the test device is that the app has been switched to the background and the iOS app switcher is showing. I can see my app (TimeClock). It appears from both the error message and the device screen that UI Automation isn't able to select my app for transition to the foreground.</p>
  
  <p>Has anyone else encountered this problem? Is there a work-around?</p>
  
  <p>Thanks.</p>