appium-webdriveragent 5.13.2 → 5.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.14.0](https://github.com/appium/WebDriverAgent/compare/v5.13.3...v5.14.0) (2023-11-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * use khidusage_keyboardclear to `clear` for iOS/iPad as the 1st attempt, tune tvOS ([#811](https://github.com/appium/WebDriverAgent/issues/811)) ([dd093ea](https://github.com/appium/WebDriverAgent/commit/dd093ea0b7209c3d2f3d0b1fa7f3a7b58507dd2d))
7
+
8
+ ## [5.13.3](https://github.com/appium/WebDriverAgent/compare/v5.13.2...v5.13.3) (2023-11-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * unrecognized selector sent to instance 0x2829adb20 error in clear ([#809](https://github.com/appium/WebDriverAgent/issues/809)) ([79832bc](https://github.com/appium/WebDriverAgent/commit/79832bc6c69e289091fbbb97aee6a1f1d17ca4c3))
14
+
1
15
  ## [5.13.2](https://github.com/appium/WebDriverAgent/compare/v5.13.1...v5.13.2) (2023-11-06)
2
16
 
3
17
 
@@ -15,11 +15,12 @@
15
15
  #import "NSString+FBVisualLength.h"
16
16
  #import "FBXCElementSnapshotWrapper.h"
17
17
  #import "FBXCElementSnapshotWrapper+Helpers.h"
18
+ #import "XCUIDevice+FBHelpers.h"
18
19
  #import "XCUIElement+FBCaching.h"
19
20
  #import "XCUIElement+FBUtilities.h"
20
21
  #import "FBXCodeCompatibility.h"
21
22
 
22
- #define MAX_CLEAR_RETRIES 2
23
+ #define MAX_CLEAR_RETRIES 3
23
24
 
24
25
 
25
26
  @interface NSString (FBRepeat)
@@ -136,22 +137,32 @@
136
137
  backspaceDeleteSequence = [[NSString alloc] initWithData:(NSData *)[@"\\u0008\\u007F" dataUsingEncoding:NSASCIIStringEncoding]
137
138
  encoding:NSNonLossyASCIIStringEncoding];
138
139
  });
139
-
140
+
141
+ NSUInteger preClearTextLength = [currentValue fb_visualLength];
142
+ NSString *backspacesToType = [backspaceDeleteSequence fb_repeatTimes:preClearTextLength];
143
+
144
+ #if TARGET_OS_IOS
140
145
  NSUInteger retry = 0;
141
146
  NSString *placeholderValue = snapshot.placeholderValue;
142
- NSUInteger preClearTextLength = [currentValue fb_visualLength];
143
147
  do {
144
- if (retry >= MAX_CLEAR_RETRIES - 1) {
145
- // Last chance retry. Tripple-tap the field to select its content
146
- [self tapWithNumberOfTaps:3 numberOfTouches:1];
147
- return [FBKeyboard typeText:backspaceDeleteSequence error:error];
148
- }
149
-
150
- NSString *textToType = [backspaceDeleteSequence fb_repeatTimes:preClearTextLength];
148
+ // the ios needs to have keyboard focus to clear text
151
149
  if (shouldPrepareForInput && 0 == retry) {
152
150
  [self fb_prepareForTextInputWithSnapshot:snapshot];
153
151
  }
154
- if (![FBKeyboard typeText:textToType error:error]) {
152
+
153
+ if (retry == 0) {
154
+ // 1st attempt is via the IOHIDEvent as the fastest operation
155
+ // https://github.com/appium/appium/issues/19389
156
+ [[XCUIDevice sharedDevice] fb_performIOHIDEventWithPage:0x07 // kHIDPage_KeyboardOrKeypad
157
+ usage:0x9c // kHIDUsage_KeyboardClear
158
+ duration:0.01
159
+ error:nil];
160
+ } else if (retry >= MAX_CLEAR_RETRIES - 1) {
161
+ // Last chance retry. Tripple-tap the field to select its content
162
+ [self tapWithNumberOfTaps:3 numberOfTouches:1];
163
+ return [FBKeyboard typeText:backspaceDeleteSequence error:error];
164
+ } else if (![FBKeyboard typeText:backspacesToType error:error]) {
165
+ // 2nd operation
155
166
  return NO;
156
167
  }
157
168
 
@@ -165,6 +176,13 @@
165
176
  retry++;
166
177
  } while (preClearTextLength > 0);
167
178
  return YES;
179
+ #else
180
+ // tvOS does not need a focus.
181
+ // kHIDPage_KeyboardOrKeypad did not work for tvOS's search field. (tvOS 17 at least)
182
+ // Tested XCUIElementTypeSearchField and XCUIElementTypeTextView whch were
183
+ // common search field and email/passowrd input in tvOS apps.
184
+ return [FBKeyboard typeText:backspacesToType error:error];
185
+ #endif
168
186
  }
169
187
 
170
188
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "5.13.2",
3
+ "version": "5.14.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {