Skip to content

Commit 6fbf62e

Browse files
feat: expose customActions on the element
Add support for exposing custom accessibility actions from UI elements
1 parent b6fc4e9 commit 6fbf62e

File tree

14 files changed

+229
-7
lines changed

14 files changed

+229
-7
lines changed

WebDriverAgent.xcodeproj/project.pbxproj

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@
529529
71F5BE50252F14EB00EE9EBA /* FBExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 71F5BE4D252F14EB00EE9EBA /* FBExceptions.h */; };
530530
71F5BE51252F14EB00EE9EBA /* FBExceptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F5BE4E252F14EB00EE9EBA /* FBExceptions.m */; };
531531
71F5BE52252F14EB00EE9EBA /* FBExceptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 71F5BE4E252F14EB00EE9EBA /* FBExceptions.m */; };
532+
AABBCCDDEEFF001122334457 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AABBCCDDEEFF001122334456 /* SceneDelegate.m */; };
532533
AD35D06C1CF1C35500870A75 /* WebDriverAgentLib.framework in Copy frameworks */ = {isa = PBXBuildFile; fileRef = EE158A991CBD452B00A3E3F0 /* WebDriverAgentLib.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
533534
AD6C26941CF2379700F8B5FF /* FBAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = AD6C26921CF2379700F8B5FF /* FBAlert.h */; settings = {ATTRIBUTES = (Public, ); }; };
534535
AD6C26951CF2379700F8B5FF /* FBAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = AD6C26931CF2379700F8B5FF /* FBAlert.m */; };
@@ -799,7 +800,6 @@
799800
EE9B76591CF7987800275851 /* FBRouteTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9B76571CF7987300275851 /* FBRouteTests.m */; };
800801
EE9B768E1CF7997600275851 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9B76831CF7997600275851 /* AppDelegate.m */; };
801802
EE9B768F1CF7997600275851 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9B76851CF7997600275851 /* ViewController.m */; };
802-
AABBCCDDEEFF001122334457 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AABBCCDDEEFF001122334456 /* SceneDelegate.m */; };
803803
EE9B76911CF7997600275851 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9B76871CF7997600275851 /* main.m */; };
804804
EE9B76941CF7997600275851 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE9B768C1CF7997600275851 /* Main.storyboard */; };
805805
EE9B769A1CF799F400275851 /* FBAlertTests.m in Sources */ = {isa = PBXBuildFile; fileRef = EE9B76991CF799F400275851 /* FBAlertTests.m */; };
@@ -822,6 +822,10 @@
822822
EEE3764A1D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = EEE376481D59FAE900ED88DD /* XCUIElement+FBWebDriverAttributes.m */; };
823823
EEE9B4721CD02B88009D2030 /* FBRunLoopSpinner.h in Headers */ = {isa = PBXBuildFile; fileRef = EEE9B4701CD02B88009D2030 /* FBRunLoopSpinner.h */; settings = {ATTRIBUTES = (Public, ); }; };
824824
EEE9B4731CD02B88009D2030 /* FBRunLoopSpinner.m in Sources */ = {isa = PBXBuildFile; fileRef = EEE9B4711CD02B88009D2030 /* FBRunLoopSpinner.m */; };
825+
F59CD6D42EF16E5E00F91287 /* XCUIElement+FBCustomActions.h in Headers */ = {isa = PBXBuildFile; fileRef = F59CD6D22EF16E5E00F91287 /* XCUIElement+FBCustomActions.h */; };
826+
F59CD6D52EF16E5E00F91287 /* XCUIElement+FBCustomActions.m in Sources */ = {isa = PBXBuildFile; fileRef = F59CD6D32EF16E5E00F91287 /* XCUIElement+FBCustomActions.m */; };
827+
F59CD6D62EF16E5E00F91287 /* XCUIElement+FBCustomActions.h in Headers */ = {isa = PBXBuildFile; fileRef = F59CD6D22EF16E5E00F91287 /* XCUIElement+FBCustomActions.h */; };
828+
F59CD6D72EF16E5E00F91287 /* XCUIElement+FBCustomActions.m in Sources */ = {isa = PBXBuildFile; fileRef = F59CD6D32EF16E5E00F91287 /* XCUIElement+FBCustomActions.m */; };
825829
/* End PBXBuildFile section */
826830

827831
/* Begin PBXContainerItemProxy section */
@@ -1110,6 +1114,8 @@
11101114
71F5BE33252E5B2200EE9EBA /* FBElementSwipingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBElementSwipingTests.m; sourceTree = "<group>"; };
11111115
71F5BE4D252F14EB00EE9EBA /* FBExceptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FBExceptions.h; sourceTree = "<group>"; };
11121116
71F5BE4E252F14EB00EE9EBA /* FBExceptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FBExceptions.m; sourceTree = "<group>"; };
1117+
AABBCCDDEEFF001122334455 /* SceneDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; };
1118+
AABBCCDDEEFF001122334456 /* SceneDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
11131119
AD42DD2A1CF121E600806E5D /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
11141120
AD6C26921CF2379700F8B5FF /* FBAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FBAlert.h; path = WebDriverAgentLib/FBAlert.h; sourceTree = SOURCE_ROOT; };
11151121
AD6C26931CF2379700F8B5FF /* FBAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = FBAlert.m; path = WebDriverAgentLib/FBAlert.m; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
@@ -1369,8 +1375,6 @@
13691375
EE9B76581CF7987300275851 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
13701376
EE9B76821CF7997600275851 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
13711377
EE9B76831CF7997600275851 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
1372-
AABBCCDDEEFF001122334455 /* SceneDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; };
1373-
AABBCCDDEEFF001122334456 /* SceneDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
13741378
EE9B76841CF7997600275851 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
13751379
EE9B76851CF7997600275851 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
13761380
EE9B76861CF7997600275851 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -1404,6 +1408,8 @@
14041408
EEE9B4701CD02B88009D2030 /* FBRunLoopSpinner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FBRunLoopSpinner.h; sourceTree = "<group>"; };
14051409
EEE9B4711CD02B88009D2030 /* FBRunLoopSpinner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBRunLoopSpinner.m; sourceTree = "<group>"; };
14061410
EEF9882A1C486603005CA669 /* WebDriverAgentRunner.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebDriverAgentRunner.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
1411+
F59CD6D22EF16E5E00F91287 /* XCUIElement+FBCustomActions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "XCUIElement+FBCustomActions.h"; sourceTree = "<group>"; };
1412+
F59CD6D32EF16E5E00F91287 /* XCUIElement+FBCustomActions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "XCUIElement+FBCustomActions.m"; sourceTree = "<group>"; };
14071413
/* End PBXFileReference section */
14081414

14091415
/* Begin PBXFrameworksBuildPhase section */
@@ -1820,6 +1826,8 @@
18201826
71E75E6C254824230099FC87 /* XCUIElementQuery+FBHelpers.m */,
18211827
13DE7A59287CA444003243C6 /* FBXCElementSnapshotWrapper+Helpers.h */,
18221828
13DE7A5A287CA444003243C6 /* FBXCElementSnapshotWrapper+Helpers.m */,
1829+
F59CD6D22EF16E5E00F91287 /* XCUIElement+FBCustomActions.h */,
1830+
F59CD6D32EF16E5E00F91287 /* XCUIElement+FBCustomActions.m */,
18231831
);
18241832
name = Categories;
18251833
path = WebDriverAgentLib/Categories;
@@ -2521,6 +2529,7 @@
25212529
641EE6E42240C5CA00173FCB /* XCKeyboardLayout.h in Headers */,
25222530
641EE6E52240C5CA00173FCB /* XCTAsyncActivity-Protocol.h in Headers */,
25232531
641EE6E62240C5CA00173FCB /* XCActivityRecord.h in Headers */,
2532+
F59CD6D62EF16E5E00F91287 /* XCUIElement+FBCustomActions.h in Headers */,
25242533
71822765258744C700661B83 /* HTTPDataResponse.h in Headers */,
25252534
641EE6E72240C5CA00173FCB /* XCUIElement+FBFind.h in Headers */,
25262535
641EE6E82240C5CA00173FCB /* XCTestManager_ManagerInterface-Protocol.h in Headers */,
@@ -2556,6 +2565,7 @@
25562565
719CD8F82126C78F00C7D0C2 /* FBAlertsMonitor.h in Headers */,
25572566
EE158AE41CBD456F00A3E3F0 /* FBSession.h in Headers */,
25582567
13DE7A55287CA1EC003243C6 /* FBXCElementSnapshotWrapper.h in Headers */,
2568+
F59CD6D42EF16E5E00F91287 /* XCUIElement+FBCustomActions.h in Headers */,
25592569
EE35AD0F1E3B77D600A02D78 /* _XCTestImplementation.h in Headers */,
25602570
71241D7B1FAE3D2500B9559F /* FBTouchActionCommands.h in Headers */,
25612571
EE158ACA1CBD456F00A3E3F0 /* FBTouchIDCommands.h in Headers */,
@@ -3117,6 +3127,7 @@
31173127
isa = PBXSourcesBuildPhase;
31183128
buildActionMask = 2147483647;
31193129
files = (
3130+
F59CD6D72EF16E5E00F91287 /* XCUIElement+FBCustomActions.m in Sources */,
31203131
64E3502E2AC0B6EB005F3ACB /* NSDictionary+FBUtf8SafeDictionary.m in Sources */,
31213132
718226CF2587443700661B83 /* GCDAsyncSocket.m in Sources */,
31223133
E444DCBC24917A5E0060D7EB /* HTTPResponseProxy.m in Sources */,
@@ -3323,6 +3334,7 @@
33233334
71D475C42538F5A8008D9401 /* XCUIApplicationProcess+FBQuiescence.m in Sources */,
33243335
641EE7082240CDEB00173FCB /* XCUIElement+FBTVFocuse.m in Sources */,
33253336
71E75E6F254824230099FC87 /* XCUIElementQuery+FBHelpers.m in Sources */,
3337+
F59CD6D52EF16E5E00F91287 /* XCUIElement+FBCustomActions.m in Sources */,
33263338
71D04DCA25356C43008A052C /* XCUIElement+FBCaching.m in Sources */,
33273339
EE158AEB1CBD456F00A3E3F0 /* FBRuntimeUtils.m in Sources */,
33283340
EEE376461D59F81400ED88DD /* XCUIElement+FBUtilities.m in Sources */,

WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ + (NSDictionary *)dictionaryForElement:(id<FBXCElementSnapshot>)snapshot
204204
info[@"value"] = FBValueOrNull(wrappedSnapshot.wdValue);
205205
info[@"label"] = FBValueOrNull(wrappedSnapshot.wdLabel);
206206
info[@"rect"] = wrappedSnapshot.wdRect;
207+
info[@"customActions"] = FBValueOrNull(wrappedSnapshot.wdCustomActions);
207208

208209
NSDictionary<NSString *, NSString *(^)(void)> *attributeBlocks = [self fb_attributeBlockMapForWrappedSnapshot:wrappedSnapshot];
209210

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
#import <WebDriverAgentLib/FBXCElementSnapshotWrapper.h>
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
@interface XCUIElement (FBCustomActions)
14+
15+
/*! Custom accessibility actions as a string – may be nil if the element does not have this attribute */
16+
@property (nonatomic, readonly, nullable) NSString *fb_customActions;
17+
18+
@end
19+
20+
@interface FBXCElementSnapshotWrapper (FBCustomActions)
21+
22+
/*! Custom accessibility actions as a string – may be nil if the element does not have this attribute */
23+
@property (nonatomic, readonly, nullable) NSString *fb_customActions;
24+
25+
@end
26+
27+
NS_ASSUME_NONNULL_END
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
#import "XCUIElement+FBCustomActions.h"
10+
#import "XCUIElement+FBUtilities.h"
11+
#import "FBXCElementSnapshotWrapper+Helpers.h"
12+
#import "FBLogger.h"
13+
#import "XCTestPrivateSymbols.h"
14+
15+
@interface FBXCElementSnapshotWrapper (FBCustomActionsInternal)
16+
17+
- (NSString *)fb_stringAttribute:(NSString *)attributeName
18+
symbol:(NSNumber *)symbol;
19+
20+
@end
21+
22+
@implementation XCUIElement (FBCustomActions)
23+
24+
- (NSString *)fb_customActions
25+
{
26+
@autoreleasepool {
27+
id<FBXCElementSnapshot> snapshot = [self fb_standardSnapshot];
28+
return [[FBXCElementSnapshotWrapper ensureWrapped:snapshot]
29+
fb_customActions];
30+
}
31+
}
32+
33+
@end
34+
35+
36+
@implementation FBXCElementSnapshotWrapper(FBCustomActions)
37+
38+
- (NSString *)fb_customActions
39+
{
40+
return [self fb_stringAttribute:FB_XCAXACustomActionsAttributeName
41+
symbol:FB_XCAXACustomActionsAttribute];
42+
}
43+
44+
- (NSString *)fb_stringAttribute:(NSString *)attributeName
45+
symbol:(NSNumber *)symbol
46+
{
47+
id cached = (self.snapshot.additionalAttributes ?: @{})[symbol];
48+
if ([cached isKindOfClass:[NSString class]]) {
49+
return cached;
50+
}
51+
52+
NSError *error = nil;
53+
id raw = [self fb_attributeValue:attributeName error:&error];
54+
if (raw == nil) {
55+
[FBLogger logFmt: @"[FBCustomActions] Cannot determine string value for %@: %@",
56+
attributeName, error.localizedDescription];
57+
return nil;
58+
}
59+
60+
// Case 1: Already a string
61+
if ([raw isKindOfClass:[NSString class]]) {
62+
NSMutableDictionary *updated =
63+
(self.additionalAttributes ?: @{}).mutableCopy;
64+
updated[symbol] = raw;
65+
self.snapshot.additionalAttributes = updated.copy;
66+
return raw;
67+
}
68+
69+
// Case 2: Array of custom actions
70+
if ([raw isKindOfClass:[NSArray class]]) {
71+
NSMutableArray *stringified = [NSMutableArray array];
72+
for (id action in (NSArray *)raw) {
73+
NSString *title = nil;
74+
75+
if ([action isKindOfClass:[NSDictionary class]]) {
76+
title = ((NSDictionary *)action)[@"CustomActionName"];
77+
}
78+
79+
if (!title || ![title isKindOfClass:[NSString class]]) {
80+
@try {
81+
title = [action valueForKey:@"title"];
82+
} @catch (__unused NSException * e) {
83+
title = @"<unknown>";
84+
}
85+
}
86+
87+
[stringified addObject:title ?: @"<null>"];
88+
NSLog(@"[FBCustomActions] Custom action title: %@", title);
89+
}
90+
91+
NSString *joined = [stringified componentsJoinedByString:@", "];
92+
NSMutableDictionary *updated =
93+
(self.additionalAttributes ?: @{}).mutableCopy;
94+
updated[symbol] = joined;
95+
self.snapshot.additionalAttributes = updated.copy;
96+
return joined;
97+
}
98+
99+
// Fallback: Try to cast to string
100+
NSString *stringValue = [NSString stringWithFormat:@"%@", raw];
101+
NSMutableDictionary *updated = (self.additionalAttributes ?: @{}).mutableCopy;
102+
updated[symbol] = stringValue;
103+
self.snapshot.additionalAttributes = updated.copy;
104+
return stringValue;
105+
}
106+
107+
@end

WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#import "XCUIHitPointResult.h"
2525
#import "FBAccessibilityTraits.h"
2626
#import "XCUIElement+FBMinMax.h"
27+
#import "XCUIElement+FBCustomActions.h"
2728

2829
#define BROKEN_RECT CGRectMake(-1, -1, 0, 0)
2930

@@ -285,4 +286,9 @@ - (NSDictionary *)wdRect
285286
};
286287
}
287288

289+
- (NSString *)wdCustomActions
290+
{
291+
return self.fb_customActions;
292+
}
293+
288294
@end

WebDriverAgentLib/Commands/FBSessionCommands.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ + (NSArray *)routes
355355
FB_SETTING_INCLUDE_HITTABLE_IN_PAGE_SOURCE: @([FBConfiguration includeHittableInPageSource]),
356356
FB_SETTING_INCLUDE_NATIVE_FRAME_IN_PAGE_SOURCE: @([FBConfiguration includeNativeFrameInPageSource]),
357357
FB_SETTING_INCLUDE_MIN_MAX_VALUE_IN_PAGE_SOURCE: @([FBConfiguration includeMinMaxValueInPageSource]),
358+
FB_SETTING_INCLUDE_CUSTOM_ACTIONS_IN_PAGE_SOURCE: @([FBConfiguration includeCustomActionsInPageSource]),
358359
FB_SETTING_ENFORCE_CUSTOM_SNAPSHOTS: @([FBConfiguration enforceCustomSnapshots]),
359360
FB_SETTING_LIMIT_XPATH_CONTEXT_SCOPE: @([FBConfiguration limitXpathContextScope]),
360361
#if !TARGET_OS_TV
@@ -467,6 +468,9 @@ + (NSArray *)routes
467468
if (nil != [settings objectForKey:FB_SETTING_INCLUDE_MIN_MAX_VALUE_IN_PAGE_SOURCE]) {
468469
[FBConfiguration setIncludeMinMaxValueInPageSource:[[settings objectForKey:FB_SETTING_INCLUDE_MIN_MAX_VALUE_IN_PAGE_SOURCE] boolValue]];
469470
}
471+
if (nil != [settings objectForKey:FB_SETTING_INCLUDE_CUSTOM_ACTIONS_IN_PAGE_SOURCE]) {
472+
[FBConfiguration setIncludeCustomActionsInPageSource:[[settings objectForKey:FB_SETTING_INCLUDE_CUSTOM_ACTIONS_IN_PAGE_SOURCE] boolValue]];
473+
}
470474
if (nil != [settings objectForKey:FB_SETTING_ENFORCE_CUSTOM_SNAPSHOTS]) {
471475
[FBConfiguration setEnforceCustomSnapshots:[[settings objectForKey:FB_SETTING_ENFORCE_CUSTOM_SNAPSHOTS] boolValue]];
472476
}

WebDriverAgentLib/Routing/FBElement.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ NS_ASSUME_NONNULL_BEGIN
7676
/*! Element's maximum value */
7777
@property (nonatomic, readonly, strong, nullable) NSNumber *wdMaxValue;
7878

79+
/*! Element's custom actions */
80+
@property (nonatomic, readonly, strong, nullable) NSString *wdCustomActions;
81+
7982
/**
8083
Returns value of given property specified in WebDriver Spec
8184
Check the FBElement protocol to get list of supported attributes.

WebDriverAgentLib/Utilities/FBConfiguration.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,17 @@ typedef NS_ENUM(NSInteger, FBConfigurationKeyboardPreference) {
376376
+ (void)setIncludeMinMaxValueInPageSource:(BOOL)enabled;
377377
+ (BOOL)includeMinMaxValueInPageSource;
378378

379+
/**
380+
* Whether to include `customActions` attribute in the XML page source.
381+
* Custom actions represent accessibility actions available on UI elements.
382+
* This may affect performance if used on many elements.
383+
* Disabled by default.
384+
*
385+
* @param enabled Either YES or NO
386+
*/
387+
+ (void)setIncludeCustomActionsInPageSource:(BOOL)enabled;
388+
+ (BOOL)includeCustomActionsInPageSource;
389+
379390
/**
380391
* Whether to enforce the use of custom snapshots instead of standard snapshots.
381392
* When enabled, fb_customSnapshot is always invoked instead of fb_standardSnapshot

WebDriverAgentLib/Utilities/FBConfiguration.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
static BOOL FBShouldIncludeHittableInPageSource = NO;
6464
static BOOL FBShouldIncludeNativeFrameInPageSource = NO;
6565
static BOOL FBShouldIncludeMinMaxValueInPageSource = NO;
66+
static BOOL FBShouldIncludeCustomActionsInPageSource = NO;
6667
static BOOL FBShouldEnforceCustomSnapshots = NO;
6768

6869
@implementation FBConfiguration
@@ -687,6 +688,16 @@ + (BOOL)includeMinMaxValueInPageSource
687688
return FBShouldIncludeMinMaxValueInPageSource;
688689
}
689690

691+
+ (void)setIncludeCustomActionsInPageSource:(BOOL)enabled
692+
{
693+
FBShouldIncludeCustomActionsInPageSource = enabled;
694+
}
695+
696+
+ (BOOL)includeCustomActionsInPageSource
697+
{
698+
return FBShouldIncludeCustomActionsInPageSource;
699+
}
700+
690701
+ (void)setEnforceCustomSnapshots:(BOOL)enabled
691702
{
692703
FBShouldEnforceCustomSnapshots = enabled;

WebDriverAgentLib/Utilities/FBSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ extern NSString* const FB_SETTING_AUTO_CLICK_ALERT_SELECTOR;
4242
extern NSString *const FB_SETTING_INCLUDE_HITTABLE_IN_PAGE_SOURCE;
4343
extern NSString *const FB_SETTING_INCLUDE_NATIVE_FRAME_IN_PAGE_SOURCE;
4444
extern NSString *const FB_SETTING_INCLUDE_MIN_MAX_VALUE_IN_PAGE_SOURCE;
45+
extern NSString *const FB_SETTING_INCLUDE_CUSTOM_ACTIONS_IN_PAGE_SOURCE;
4546
extern NSString *const FB_SETTING_ENFORCE_CUSTOM_SNAPSHOTS;
4647

4748
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)