0

My field in storyboard file like bellow:

<searchBar contentMode="redraw" placeholder="Tìm đầu số cố định" translatesAutoresizingMaskIntoConstraints="NO" id="yT6-iM-naf">
  <rect key="frame" x="0.0" y="148" width="375" height="44"/>
  <textInputTraits key="textInputTraits"/>
  <connections>
      <outlet property="delegate" destination="BYZ-38-t0r" id="0lh-uB-0ML"/>
  </connections>
</searchBar>

My UITest with fastlane code like this:

func testExample() {

    snapshot("0Start")   
    // 2
    //Find searchBar in here
    let search = app
            .otherElements["yT6-iM-naf"]
            .children(matching: .searchBar)
            .element
    //Click in here
    search.tap()

    search.typeText("Ho chi")
    app.keyboards.buttons["Search"].tap()

    // // 3
    snapshot("02Search")    
    // Ending
}

But it alway raise error: type 'XCUIElementType' has no member 'searchBar'

Please help me.

ThienSuBS
  • 1,574
  • 18
  • 26
  • You can do a print(app.debugDescription) to see the UI hierarchy that your test can access. Together with a wait(for:), that should give you the information you need. https://stackoverflow.com/a/42222302/102315 – Alper Sep 19 '17 at 09:40
  • `XCUIElementType` has `searchField`. Did you mean `searchField` instead of `searchBar`. Can you check the documentation in Xcode. – user1046037 Sep 19 '17 at 10:25

0 Answers0