title: iOS UITesting with XCTest & Xcode - testing dynamically added elements
body: <p>I have a tableViewCell with two switches. One is always present, the other is hidden and only appears when I set my UIPicker to a specific value. </p>
  
  <p>In my test case I set the UIPicker to the necessary value as follows:</p>
  
  <pre><code>var app = XCUIApplication()
  let tablesQuery = app.tables
     tablesQuery.cells.childrenMatchingType(.TextField).elementBoundByIndex(1).tap()
  
  app.pickerWheels["Value 1"].tap()
  app.pickerWheels["Value 1"].adjustToPickerWheelValue("Value 2")
  app.toolbars.buttons["Done"].tap()
  </code></pre>
  
  <p>Looking at the simulator, the second switch appears as needed. However, it is nowhere to be found in <code>app.switches</code>. </p>
  
  <p>I tried to reload the XCUIApplication as such:</p>
  
  <pre><code>app = XCUIApplication()
  </code></pre>
  
  <p>But in the debugger, when I printed out app.switches, the second switch wasn't there. I set the identifier for it in the Interface Builder, but still nothing. The following doesn't work:</p>
  
  <pre><code>        let current401kToggle = app.switches.elementMatchingType(.Switch, identifier: "Value2Toggle")
  </code></pre>
  
  <p>Any help appreciated :)
  Thanks!</p>