title: Swift 3 - Cannot call value of non-function type 'XCUIElement'
body: <p>I am trying to simplify my UITest code.  At this time I have hundreds of lines of code for checking up to eight table rows each with three text fields.  This will not only reduce the number of lines of code that I have, but it will reduce the erros that are caused by the copy/paste/edit process.</p>
  
  <p>I am getting a "Cannot call value of non-function type 'XCUIElement'" error on the three lines in the checkRow function.</p>
  
  <p>If I replace the 'thisRow' variable in the three lines with an integer, the code will compile.</p>
  
  <p>Here is the before and after.   </p>
  
  <pre><code>func testAkcCh() {
      navConfig.tap()
      pickCD.adjust(toPickerWheelValue: "4")
      pickCB.adjust(toPickerWheelValue: "5")
      pickSD.adjust(toPickerWheelValue: "3")
      pickSB.adjust(toPickerWheelValue: "2")
      XCTAssert(app.tables.cells.count == 8)
      XCTAssert(app.tables.cells.element(boundBy: 0).staticTexts["Best of Breed"].exists)
      XCTAssert(app.tables.cells.element(boundBy: 0).staticTexts[p5].exists)
      XCTAssert(app.tables.cells.element(boundBy: 0).staticTexts[d13].exists)
      XCTAssert(app.tables.cells.element(boundBy: 1).staticTexts["Best of Opposite Sex"].exists)
      XCTAssert(app.tables.cells.element(boundBy: 1).staticTexts[p5].exists)
      XCTAssert(app.tables.cells.element(boundBy: 1).staticTexts[d06].exists)
  }
  </code></pre>
  
  <p>into</p>
  
  <pre><code>func checkRow(thisRow: Int, thisAward: String, thisPoints: String, thisDefeated: String) {
      XCTAssert(app.tables.cells.element(boundBy: thisRow).staticTexts[thisAward].exists)
      XCTAssert(app.tables.cells.element(boundBy: thisRow).staticTexts[thisPoints].exists)
      XCTAssert(app.tables.cells.element(boundBy: thisRow).staticTexts[thisDefeated].exists)
  }
  
  func testAkcCh() {
      navConfig.tap()
      pickCD.adjust(toPickerWheelValue: "4")
      pickCB.adjust(toPickerWheelValue: "5")
      pickSD.adjust(toPickerWheelValue: "3")
      pickSB.adjust(toPickerWheelValue: "2")
      XCTAssert(app.tables.cells.count == 8)
      checkRow(0, "Best of Breed", p5, d13)
      checkRow(1, "Best of Opposite Sex", p5, d06)
  }
  </code></pre>
  
  <p>This compiles, but defeated most of the benefit...</p>
  
  <pre><code>func checkRow(thisRow: Int, thisAward: String, thisPoints: String, thisDefeated: String) {
      XCTAssert(app.tables.cells.element(boundBy: 0).staticTexts[thisAward].exists)
      XCTAssert(app.tables.cells.element(boundBy: 0).staticTexts[thisPoints].exists)
      XCTAssert(app.tables.cells.element(boundBy: 0).staticTexts[thisDefeated].exists)
  }
  </code></pre>