Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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) {
- defer {
- self.typeText(text)
- }
- guard let stringValue = self.value as? String else {
- return
- }
- self.tap()
- let deleteString = stringValue.flatMap { _ in XCUIKeyboardKey.delete.rawValue }.joined()
- self.typeText(deleteString)
- }
- }
Add Comment
Please, Sign In to add comment