appium-webdriveragent 10.0.0 → 10.1.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,15 @@
1
+ ## [10.1.0](https://github.com/appium/WebDriverAgent/compare/v10.0.1...v10.1.0) (2025-09-03)
2
+
3
+ ### Features
4
+
5
+ * Add process and bundle identifiers to the application node in the XML source ([#1055](https://github.com/appium/WebDriverAgent/issues/1055)) ([088cff2](https://github.com/appium/WebDriverAgent/commit/088cff2b2bc19ddde698ec06f1db37c6989cf392))
6
+
7
+ ## [10.0.1](https://github.com/appium/WebDriverAgent/compare/v10.0.0...v10.0.1) (2025-08-23)
8
+
9
+ ### Miscellaneous Chores
10
+
11
+ * **deps-dev:** bump chai from 5.3.2 to 6.0.0 ([#1053](https://github.com/appium/WebDriverAgent/issues/1053)) ([9e9ec38](https://github.com/appium/WebDriverAgent/commit/9e9ec381bd6695e1c8b89f2a9c304b12385c0134))
12
+
1
13
  ## [10.0.0](https://github.com/appium/WebDriverAgent/compare/v9.15.3...v10.0.0) (2025-08-17)
2
14
 
3
15
  ### ⚠ BREAKING CHANGES
@@ -15,11 +15,11 @@
15
15
  <key>CFBundlePackageType</key>
16
16
  <string>FMWK</string>
17
17
  <key>CFBundleShortVersionString</key>
18
- <string>10.0.0</string>
18
+ <string>10.1.0</string>
19
19
  <key>CFBundleSignature</key>
20
20
  <string>????</string>
21
21
  <key>CFBundleVersion</key>
22
- <string>10.0.0</string>
22
+ <string>10.1.0</string>
23
23
  <key>NSPrincipalClass</key>
24
24
  <string/>
25
25
  </dict>
@@ -17,12 +17,15 @@
17
17
  #import "FBXMLGenerationOptions.h"
18
18
  #import "FBXCElementSnapshotWrapper+Helpers.h"
19
19
  #import "NSString+FBXMLSafeString.h"
20
+ #import "XCUIApplication.h"
20
21
  #import "XCUIElement.h"
21
22
  #import "XCUIElement+FBCaching.h"
22
23
  #import "XCUIElement+FBUtilities.h"
23
24
  #import "XCUIElement+FBWebDriverAttributes.h"
24
25
  #import "XCTestPrivateSymbols.h"
25
26
  #import "FBElementHelpers.h"
27
+ #import "FBXCAXClientProxy.h"
28
+ #import "FBXCAccessibilityElement.h"
26
29
 
27
30
 
28
31
  @interface FBElementAttribute : NSObject
@@ -33,6 +36,7 @@
33
36
  + (nullable NSString *)valueForElement:(id<FBElement>)element;
34
37
 
35
38
  + (int)recordWithWriter:(xmlTextWriterPtr)writer forElement:(id<FBElement>)element;
39
+ + (int)recordWithWriter:(xmlTextWriterPtr)writer forValue:(nullable NSString *)value;
36
40
 
37
41
  + (NSArray<Class> *)supportedAttributes;
38
42
 
@@ -98,7 +102,13 @@
98
102
 
99
103
  @property (nonatomic, nonnull, readonly) NSString* indexValue;
100
104
 
101
- + (int)recordWithWriter:(xmlTextWriterPtr)writer forValue:(NSString *)value;
105
+ @end
106
+
107
+ @interface FBApplicationBundleIdAttribute : FBElementAttribute
108
+
109
+ @end
110
+
111
+ @interface FBApplicationPidAttribute : FBElementAttribute
102
112
 
103
113
  @end
104
114
 
@@ -472,6 +482,27 @@ static NSString *const topNodeIndexPath = @"top";
472
482
  // index path is the special case
473
483
  return [FBInternalIndexAttribute recordWithWriter:writer forValue:indexPath];
474
484
  }
485
+ if (element.elementType == XCUIElementTypeApplication) {
486
+ // only record process identifier and bundle identifier for the application element
487
+ int pid = [element.accessibilityElement processIdentifier];
488
+ if (pid > 0) {
489
+ int rc = [FBApplicationPidAttribute recordWithWriter:writer
490
+ forValue:[NSString stringWithFormat:@"%d", pid]];
491
+ if (rc < 0) {
492
+ return rc;
493
+ }
494
+ XCUIApplication *app = [[FBXCAXClientProxy sharedClient]
495
+ monitoredApplicationWithProcessIdentifier:pid];
496
+ NSString *bundleID = [app bundleID];
497
+ if (nil != bundleID) {
498
+ rc = [FBApplicationBundleIdAttribute recordWithWriter:writer
499
+ forValue:bundleID];
500
+ if (rc < 0) {
501
+ return rc;
502
+ }
503
+ }
504
+ }
505
+ }
475
506
  return 0;
476
507
  }
477
508
 
@@ -585,6 +616,11 @@ static NSString *const FBAbstractMethodInvocationException = @"AbstractMethodInv
585
616
  + (int)recordWithWriter:(xmlTextWriterPtr)writer forElement:(id<FBElement>)element
586
617
  {
587
618
  NSString *value = [self valueForElement:element];
619
+ return [self recordWithWriter:writer forValue:value];
620
+ }
621
+
622
+ + (int)recordWithWriter:(xmlTextWriterPtr)writer forValue:(nullable NSString *)value
623
+ {
588
624
  if (nil == value) {
589
625
  // Skip the attribute if the value equals to nil
590
626
  return 0;
@@ -830,22 +866,25 @@ static NSString *const FBAbstractMethodInvocationException = @"AbstractMethodInv
830
866
  return kXMLIndexPathKey;
831
867
  }
832
868
 
833
- + (int)recordWithWriter:(xmlTextWriterPtr)writer forValue:(NSString *)value
869
+ @end
870
+
871
+ @implementation FBApplicationBundleIdAttribute : FBElementAttribute
872
+
873
+ + (NSString *)name
834
874
  {
835
- if (nil == value) {
836
- // Skip the attribute if the value equals to nil
837
- return 0;
838
- }
839
- int rc = xmlTextWriterWriteAttribute(writer,
840
- (xmlChar *)[[FBXPath safeXmlStringWithString:[self name]] UTF8String],
841
- (xmlChar *)[[FBXPath safeXmlStringWithString:value] UTF8String]);
842
- if (rc < 0) {
843
- [FBLogger logFmt:@"Failed to invoke libxml2>xmlTextWriterWriteAttribute(%@='%@'). Error code: %d", [self name], value, rc];
844
- }
845
- return rc;
875
+ return @"bundleId";
846
876
  }
877
+
847
878
  @end
848
879
 
880
+ @implementation FBApplicationPidAttribute : FBElementAttribute
881
+
882
+ + (NSString *)name
883
+ {
884
+ return @"processId";
885
+ }
886
+
887
+ @end
849
888
 
850
889
  @implementation FBPlaceholderValueAttribute
851
890
 
@@ -13,9 +13,11 @@
13
13
  #import "FBMacros.h"
14
14
  #import "FBTestMacros.h"
15
15
  #import "FBXPath.h"
16
+ #import "FBXCAccessibilityElement.h"
16
17
  #import "FBXCodeCompatibility.h"
17
18
  #import "FBXCElementSnapshotWrapper+Helpers.h"
18
19
  #import "FBXMLGenerationOptions.h"
20
+ #import "XCUIApplication.h"
19
21
  #import "XCUIElement.h"
20
22
  #import "XCUIElement+FBFind.h"
21
23
  #import "XCUIElement+FBUtilities.h"
@@ -50,6 +52,19 @@
50
52
  return snapshot;
51
53
  }
52
54
 
55
+ - (void)testApplicationNodeXMLRepresentation
56
+ {
57
+ id<FBXCElementSnapshot> snapshot = [self.testedApplication fb_customSnapshot];
58
+ snapshot.children = @[];
59
+ FBXCElementSnapshotWrapper *wrappedSnapshot = [FBXCElementSnapshotWrapper ensureWrapped:snapshot];
60
+ NSString *xmlStr = [FBXPath xmlStringWithRootElement:wrappedSnapshot
61
+ options:nil];
62
+ int pid = [snapshot.accessibilityElement processIdentifier];
63
+ XCTAssertNotNil(xmlStr);
64
+ NSString *expectedXml = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%@ type=\"%@\" name=\"%@\" label=\"%@\" enabled=\"%@\" visible=\"%@\" accessible=\"%@\" x=\"%@\" y=\"%@\" width=\"%@\" height=\"%@\" index=\"%lu\" traits=\"%@\" processId=\"%d\" bundleId=\"%@\"/>\n", wrappedSnapshot.wdType, wrappedSnapshot.wdType, wrappedSnapshot.wdName, wrappedSnapshot.wdLabel, FBBoolToString(wrappedSnapshot.wdEnabled), FBBoolToString(wrappedSnapshot.wdVisible), FBBoolToString(wrappedSnapshot.wdAccessible), [wrappedSnapshot.wdRect[@"x"] stringValue], [wrappedSnapshot.wdRect[@"y"] stringValue], [wrappedSnapshot.wdRect[@"width"] stringValue], [wrappedSnapshot.wdRect[@"height"] stringValue], wrappedSnapshot.wdIndex, wrappedSnapshot.wdTraits, pid, [self.testedApplication bundleID]];
65
+ XCTAssertEqualObjects(xmlStr, expectedXml);
66
+ }
67
+
53
68
  - (void)testSingleDescendantXMLRepresentation
54
69
  {
55
70
  id<FBXCElementSnapshot> snapshot = self.destinationSnapshot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-webdriveragent",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
4
4
  "description": "Package bundling WebDriverAgent",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -59,7 +59,7 @@
59
59
  "@types/mocha": "^10.0.1",
60
60
  "@types/node": "^24.0.0",
61
61
  "appium-xcode": "^6.0.0",
62
- "chai": "^5.1.1",
62
+ "chai": "^6.0.0",
63
63
  "chai-as-promised": "^8.0.0",
64
64
  "conventional-changelog-conventionalcommits": "^9.0.0",
65
65
  "node-simctl": "^8.0.0",