Skip to content

Commit

Permalink
chore: return operation error in handleKeyboardInput (#799)
Browse files Browse the repository at this point in the history
* fix: when 0 is given

* chore: return explicit unsupported error

* Update FBCustomCommands.m
  • Loading branch information
KazuCocoa authored Oct 29, 2023
1 parent deb3c05 commit 247ace6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions WebDriverAgentLib/Commands/FBCustomCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,13 @@ + (NSString *)timeZone
? [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]]
: request.session.activeApplication;
id keys = request.arguments[@"keys"];

if (![destination respondsToSelector:@selector(typeKey:modifierFlags:)]) {
NSString *message = @"typeKey API is only supported since Xcode15 and iPadOS 17";
return FBResponseWithStatus([FBCommandStatus unsupportedOperationErrorWithMessage:message
traceback:nil]);
}

if (![keys isKindOfClass:NSArray.class]) {
NSString *message = @"The 'keys' argument must be an array";
return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:message
Expand Down

0 comments on commit 247ace6

Please sign in to comment.