appium-webdriveragent 5.11.7 → 5.12.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
|
+
## [5.12.0](https://github.com/appium/WebDriverAgent/compare/v5.11.7...v5.12.0) (2023-10-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Add an endpoint for keyboard input ([#797](https://github.com/appium/WebDriverAgent/issues/797)) ([aaf70c9](https://github.com/appium/WebDriverAgent/commit/aaf70c9196e4dcb2073da151cda23b2b221d4dae))
|
|
7
|
+
|
|
1
8
|
## [5.11.7](https://github.com/appium/WebDriverAgent/compare/v5.11.6...v5.11.7) (2023-10-25)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -70,6 +70,9 @@
|
|
|
70
70
|
[[FBRoute GET:@"/wda/device/location"] respondWithTarget:self action:@selector(handleGetLocation:)],
|
|
71
71
|
[[FBRoute GET:@"/wda/device/location"].withoutSession respondWithTarget:self action:@selector(handleGetLocation:)],
|
|
72
72
|
#if !TARGET_OS_TV // tvOS does not provide relevant APIs
|
|
73
|
+
#if __clang_major__ >= 15
|
|
74
|
+
[[FBRoute POST:@"/wda/element/:uuid/keyboardInput"] respondWithTarget:self action:@selector(handleKeyboardInput:)],
|
|
75
|
+
#endif
|
|
73
76
|
[[FBRoute GET:@"/wda/simulatedLocation"] respondWithTarget:self action:@selector(handleGetSimulatedLocation:)],
|
|
74
77
|
[[FBRoute GET:@"/wda/simulatedLocation"].withoutSession respondWithTarget:self action:@selector(handleGetSimulatedLocation:)],
|
|
75
78
|
[[FBRoute POST:@"/wda/simulatedLocation"] respondWithTarget:self action:@selector(handleSetSimulatedLocation:)],
|
|
@@ -543,6 +546,48 @@
|
|
|
543
546
|
}
|
|
544
547
|
return FBResponseWithOK();
|
|
545
548
|
}
|
|
549
|
+
|
|
550
|
+
#if __clang_major__ >= 15
|
|
551
|
+
+ (id<FBResponsePayload>)handleKeyboardInput:(FBRouteRequest *)request
|
|
552
|
+
{
|
|
553
|
+
FBElementCache *elementCache = request.session.elementCache;
|
|
554
|
+
BOOL hasElement = nil != request.parameters[@"uuid"];
|
|
555
|
+
XCUIElement *destination = hasElement
|
|
556
|
+
? [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]]
|
|
557
|
+
: request.session.activeApplication;
|
|
558
|
+
id keys = request.arguments[@"keys"];
|
|
559
|
+
if (![keys isKindOfClass:NSArray.class]) {
|
|
560
|
+
NSString *message = @"The 'keys' argument must be an array";
|
|
561
|
+
return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message
|
|
562
|
+
traceback:nil]);
|
|
563
|
+
}
|
|
564
|
+
for (id item in (NSArray *)keys) {
|
|
565
|
+
if ([item isKindOfClass:NSString.class]) {
|
|
566
|
+
NSString *keyValue = [FBKeyboard keyValueForName:item] ?: item;
|
|
567
|
+
[destination typeKey:keyValue modifierFlags:XCUIKeyModifierNone];
|
|
568
|
+
} else if ([item isKindOfClass:NSDictionary.class]) {
|
|
569
|
+
id key = [(NSDictionary *)item objectForKey:@"key"];
|
|
570
|
+
if (![key isKindOfClass:NSString.class]) {
|
|
571
|
+
NSString *message = [NSString stringWithFormat:@"All dictionaries of 'keys' array must have the 'key' item of type string. Got '%@' instead in the item %@", key, item];
|
|
572
|
+
return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message
|
|
573
|
+
traceback:nil]);
|
|
574
|
+
}
|
|
575
|
+
id modifiers = [(NSDictionary *)item objectForKey:@"modifierFlags"];
|
|
576
|
+
NSUInteger modifierFlags = XCUIKeyModifierNone;
|
|
577
|
+
if ([modifiers isKindOfClass:NSNumber.class]) {
|
|
578
|
+
modifierFlags = [(NSNumber *)modifiers unsignedIntValue];
|
|
579
|
+
}
|
|
580
|
+
NSString *keyValue = [FBKeyboard keyValueForName:item] ?: key;
|
|
581
|
+
[destination typeKey:keyValue modifierFlags:modifierFlags];
|
|
582
|
+
} else {
|
|
583
|
+
NSString *message = @"All items of the 'keys' array must be either dictionaries or strings";
|
|
584
|
+
return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message
|
|
585
|
+
traceback:nil]);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return FBResponseWithOK();
|
|
589
|
+
}
|
|
590
|
+
#endif
|
|
546
591
|
#endif
|
|
547
592
|
|
|
548
593
|
+ (id<FBResponsePayload>)handlePerformAccessibilityAudit:(FBRouteRequest *)request
|
|
@@ -13,6 +13,16 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
13
13
|
|
|
14
14
|
@interface FBKeyboard : NSObject
|
|
15
15
|
|
|
16
|
+
#if (!TARGET_OS_TV && __clang_major__ >= 15)
|
|
17
|
+
/**
|
|
18
|
+
Transforms key name to its string representation, which could be used with XCTest
|
|
19
|
+
|
|
20
|
+
@param name one of available keyboard key names defined in https://developer.apple.com/documentation/xctest/xcuikeyboardkey?language=objc
|
|
21
|
+
@return Either the key value or nil if no matches have been found
|
|
22
|
+
*/
|
|
23
|
+
+ (nullable NSString *)keyValueForName:(NSString *)name;
|
|
24
|
+
#endif
|
|
25
|
+
|
|
16
26
|
/**
|
|
17
27
|
Types a string into active element. There must be element with keyboard focus; otherwise an
|
|
18
28
|
error is raised.
|
|
@@ -80,4 +80,69 @@
|
|
|
80
80
|
error:error];
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
#if (!TARGET_OS_TV && __clang_major__ >= 15)
|
|
84
|
+
|
|
85
|
+
+ (NSString *)keyValueForName:(NSString *)name
|
|
86
|
+
{
|
|
87
|
+
static dispatch_once_t onceKeys;
|
|
88
|
+
static NSDictionary<NSString *, NSString *> *keysMapping;
|
|
89
|
+
dispatch_once(&onceKeys, ^{
|
|
90
|
+
keysMapping = @{
|
|
91
|
+
@"XCUIKeyboardKeyDelete": XCUIKeyboardKeyDelete,
|
|
92
|
+
@"XCUIKeyboardKeyReturn": XCUIKeyboardKeyReturn,
|
|
93
|
+
@"XCUIKeyboardKeyEnter": XCUIKeyboardKeyEnter,
|
|
94
|
+
@"XCUIKeyboardKeyTab": XCUIKeyboardKeyTab,
|
|
95
|
+
@"XCUIKeyboardKeySpace": XCUIKeyboardKeySpace,
|
|
96
|
+
@"XCUIKeyboardKeyEscape": XCUIKeyboardKeyEscape,
|
|
97
|
+
|
|
98
|
+
@"XCUIKeyboardKeyUpArrow": XCUIKeyboardKeyUpArrow,
|
|
99
|
+
@"XCUIKeyboardKeyDownArrow": XCUIKeyboardKeyDownArrow,
|
|
100
|
+
@"XCUIKeyboardKeyLeftArrow": XCUIKeyboardKeyLeftArrow,
|
|
101
|
+
@"XCUIKeyboardKeyRightArrow": XCUIKeyboardKeyRightArrow,
|
|
102
|
+
|
|
103
|
+
@"XCUIKeyboardKeyF1": XCUIKeyboardKeyF1,
|
|
104
|
+
@"XCUIKeyboardKeyF2": XCUIKeyboardKeyF2,
|
|
105
|
+
@"XCUIKeyboardKeyF3": XCUIKeyboardKeyF3,
|
|
106
|
+
@"XCUIKeyboardKeyF4": XCUIKeyboardKeyF4,
|
|
107
|
+
@"XCUIKeyboardKeyF5": XCUIKeyboardKeyF5,
|
|
108
|
+
@"XCUIKeyboardKeyF6": XCUIKeyboardKeyF6,
|
|
109
|
+
@"XCUIKeyboardKeyF7": XCUIKeyboardKeyF7,
|
|
110
|
+
@"XCUIKeyboardKeyF8": XCUIKeyboardKeyF8,
|
|
111
|
+
@"XCUIKeyboardKeyF9": XCUIKeyboardKeyF9,
|
|
112
|
+
@"XCUIKeyboardKeyF10": XCUIKeyboardKeyF10,
|
|
113
|
+
@"XCUIKeyboardKeyF11": XCUIKeyboardKeyF11,
|
|
114
|
+
@"XCUIKeyboardKeyF12": XCUIKeyboardKeyF12,
|
|
115
|
+
@"XCUIKeyboardKeyF13": XCUIKeyboardKeyF13,
|
|
116
|
+
@"XCUIKeyboardKeyF14": XCUIKeyboardKeyF14,
|
|
117
|
+
@"XCUIKeyboardKeyF15": XCUIKeyboardKeyF15,
|
|
118
|
+
@"XCUIKeyboardKeyF16": XCUIKeyboardKeyF16,
|
|
119
|
+
@"XCUIKeyboardKeyF17": XCUIKeyboardKeyF17,
|
|
120
|
+
@"XCUIKeyboardKeyF18": XCUIKeyboardKeyF18,
|
|
121
|
+
@"XCUIKeyboardKeyF19": XCUIKeyboardKeyF19,
|
|
122
|
+
|
|
123
|
+
@"XCUIKeyboardKeyForwardDelete": XCUIKeyboardKeyForwardDelete,
|
|
124
|
+
@"XCUIKeyboardKeyHome": XCUIKeyboardKeyHome,
|
|
125
|
+
@"XCUIKeyboardKeyEnd": XCUIKeyboardKeyEnd,
|
|
126
|
+
@"XCUIKeyboardKeyPageUp": XCUIKeyboardKeyPageUp,
|
|
127
|
+
@"XCUIKeyboardKeyPageDown": XCUIKeyboardKeyPageDown,
|
|
128
|
+
@"XCUIKeyboardKeyClear": XCUIKeyboardKeyClear,
|
|
129
|
+
@"XCUIKeyboardKeyHelp": XCUIKeyboardKeyHelp,
|
|
130
|
+
|
|
131
|
+
@"XCUIKeyboardKeyCapsLock": XCUIKeyboardKeyCapsLock,
|
|
132
|
+
@"XCUIKeyboardKeyShift": XCUIKeyboardKeyShift,
|
|
133
|
+
@"XCUIKeyboardKeyControl": XCUIKeyboardKeyControl,
|
|
134
|
+
@"XCUIKeyboardKeyOption": XCUIKeyboardKeyOption,
|
|
135
|
+
@"XCUIKeyboardKeyCommand": XCUIKeyboardKeyCommand,
|
|
136
|
+
@"XCUIKeyboardKeyRightShift": XCUIKeyboardKeyRightShift,
|
|
137
|
+
@"XCUIKeyboardKeyRightControl": XCUIKeyboardKeyRightControl,
|
|
138
|
+
@"XCUIKeyboardKeyRightOption": XCUIKeyboardKeyRightOption,
|
|
139
|
+
@"XCUIKeyboardKeyRightCommand": XCUIKeyboardKeyRightCommand,
|
|
140
|
+
@"XCUIKeyboardKeySecondaryFn": XCUIKeyboardKeySecondaryFn
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
return keysMapping[name];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#endif
|
|
147
|
+
|
|
83
148
|
@end
|