appium-webdriveragent 4.12.2 → 4.13.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,10 @@
1
+ ## [4.13.0](https://github.com/appium/WebDriverAgent/compare/v4.12.2...v4.13.0) (2023-02-23)
2
+
3
+
4
+ ### Features
5
+
6
+ * Increase Xpath Lookup Performance ([#666](https://github.com/appium/WebDriverAgent/issues/666)) ([1696f4b](https://github.com/appium/WebDriverAgent/commit/1696f4bb879152ef04408940849708654072c797))
7
+
1
8
  ## [4.12.2](https://github.com/appium/WebDriverAgent/compare/v4.12.1...v4.12.2) (2023-02-22)
2
9
 
3
10
 
@@ -47,9 +47,7 @@ static char XCUIELEMENT_IS_RESOLVED_NATIVELY_KEY;
47
47
  if (nil == uid) {
48
48
  return self;
49
49
  }
50
- NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id<FBXCElementSnapshot> snapshot, NSDictionary *bindings) {
51
- return [[FBXCElementSnapshotWrapper wdUIDWithSnapshot:snapshot] isEqualToString:uid];
52
- }];
50
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K = %@",FBStringify(FBXCElementSnapshotWrapper, fb_uid), uid];
53
51
  return [query matchingPredicate:predicate].allElementsBoundByIndex.firstObject ?: self;
54
52
  }
55
53
 
@@ -7,6 +7,8 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  */
9
9
 
10
+ #import <objc/runtime.h>
11
+
10
12
  #import "XCUIElement+FBUID.h"
11
13
 
12
14
  #import "FBElementUtils.h"
@@ -33,6 +35,17 @@
33
35
 
34
36
  @implementation FBXCElementSnapshotWrapper (FBUID)
35
37
 
38
+ #pragma clang diagnostic push
39
+ #pragma clang diagnostic ignored "-Wobjc-load-method"
40
+ + (void)load
41
+ {
42
+ Class XCElementSnapshotCls = objc_lookUpClass("XCElementSnapshot");
43
+ NSAssert(XCElementSnapshotCls != nil, @"Could not locate XCElementSnapshot class");
44
+ Method uidMethod = class_getInstanceMethod(self.class, @selector(fb_uid));
45
+ class_addMethod(XCElementSnapshotCls, @selector(fb_uid), method_getImplementation(uidMethod), method_getTypeEncoding(uidMethod));
46
+ }
47
+ #pragma diagnostic pop
48
+
36
49
  - (unsigned long long)fb_accessibiltyId
37
50
  {
38
51
  return [FBElementUtils idWithAccessibilityElement:self.accessibilityElement];
@@ -45,7 +58,10 @@
45
58
 
46
59
  - (NSString *)fb_uid
47
60
  {
48
- return [self.class wdUIDWithSnapshot:self.snapshot];
61
+ if ([self isKindOfClass:FBXCElementSnapshotWrapper.class]) {
62
+ return [self.class wdUIDWithSnapshot:self.snapshot];
63
+ }
64
+ return [FBElementUtils uidWithAccessibilityElement:[self accessibilityElement]];
49
65
  }
50
66
 
51
67
  @end
@@ -162,10 +162,10 @@
162
162
  XCUIElementQuery *query = onlyChildren
163
163
  ? [self.fb_query childrenMatchingType:type]
164
164
  : [self.fb_query descendantsMatchingType:type];
165
- NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id<FBXCElementSnapshot> snapshot, NSDictionary *bindings) {
166
- return [matchedIds containsObject:[FBXCElementSnapshotWrapper wdUIDWithSnapshot:snapshot] ?: @""];
167
- }];
165
+
166
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K IN %@",FBStringify(FBXCElementSnapshotWrapper, fb_uid), matchedIds];
168
167
  [matchedElements addObjectsFromArray:[query matchingPredicate:predicate].allElementsBoundByIndex];
168
+
169
169
  for (XCUIElement *el in matchedElements) {
170
170
  el.fb_isResolvedNatively = @NO;
171
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "4.12.2",
3
+ "version": "4.13.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {