lib/calabash-cucumber/keyboard_helpers.rb in calabash-cucumber-0.17.0 vs lib/calabash-cucumber/keyboard_helpers.rb in calabash-cucumber-0.17.1
- old
+ new
@@ -321,10 +321,15 @@
# on iOS 6, the Delete char code is _not_ \b
# on iOS 7, the Delete char code is \b on non-numeric keyboards
# on numeric keyboards, it is actually a button on the
# keyboard and not a key
if code.eql?(UIA_SUPPORTED_CHARS['Delete'])
- uia("uia.keyboard().elements().firstWithName('Delete').tap()")
+ js_tap_delete = "(function() {"\
+ "var deleteElement = uia.keyboard().elements().firstWithName('Delete');"\
+ "deleteElement = deleteElement.isValid() ? deleteElement : uia.keyboard().elements().firstWithName('delete');"\
+ "deleteElement.tap();"\
+ "})();"
+ uia(js_tap_delete)
else
uia_type_string_raw(code)
end
end
# noinspection RubyStringKeysInHashInspection