Created
October 17, 2017 14:45
-
-
Save olbrichj/e833125681d8cfe08c90ab82ec5464b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension XCUIElement { | |
func write(string: String) { | |
guard let stringValue = self.value as? String else { | |
XCTFail("Tried to clear and enter text into a non string value") | |
return | |
} | |
self.tap() | |
// clear element before writing new text | |
let deleteString = stringValue.characters.map { _ in XCUIKeyboardKeyDelete }.joined(separator: "") | |
self.typeText(deleteString) | |
self.typeText(string) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment