I am trying to delete the previous value from text view,but I am unable to since the cursor is always at the beginning of text view.I am using
extension XCUIElement {
/**
Removes any current text in the field before typing in the new value
- Parameter text: the text to enter into the field
*/
func clearAndEnterText(text: String) -> Void {
guard let stringValue = self.value as? String else {
XCTFail("Tried to clear and enter text into a non string value")
return
}
self.tap()
let deleteString = stringValue.characters.map { _ in XCUIKeyboardKeyDelete }.joinWithSeparator("")
self.typeText(deleteString)
self.typeText(text)
}
}