From 635f5d14076a060e0df3ca2652c3a218efb877ed Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 28 Oct 2023 14:22:45 -0700 Subject: [PATCH 1/3] fix: when 0 is given --- WebDriverAgentLib/Commands/FBCustomCommands.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebDriverAgentLib/Commands/FBCustomCommands.m b/WebDriverAgentLib/Commands/FBCustomCommands.m index 934cdf73f..21b67173f 100644 --- a/WebDriverAgentLib/Commands/FBCustomCommands.m +++ b/WebDriverAgentLib/Commands/FBCustomCommands.m @@ -551,7 +551,7 @@ + (NSString *)timeZone + (id)handleKeyboardInput:(FBRouteRequest *)request { FBElementCache *elementCache = request.session.elementCache; - BOOL hasElement = nil != request.parameters[@"uuid"]; + BOOL hasElement = ![request.parameters[@"uuid"] isEqual:@"0"]; XCUIElement *destination = hasElement ? [elementCache elementForUUID:(NSString *)request.parameters[@"uuid"]] : request.session.activeApplication; From 45641605c9f66530148aea18e05185e62d81ea9f Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sat, 28 Oct 2023 15:01:43 -0700 Subject: [PATCH 2/3] chore: return explicit unsupported error --- WebDriverAgentLib/Commands/FBCustomCommands.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/WebDriverAgentLib/Commands/FBCustomCommands.m b/WebDriverAgentLib/Commands/FBCustomCommands.m index 21b67173f..0fad267c3 100644 --- a/WebDriverAgentLib/Commands/FBCustomCommands.m +++ b/WebDriverAgentLib/Commands/FBCustomCommands.m @@ -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 = @"Not supported on this OS version"; + 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 From d7a75247edfb5a4ef28fc09437ad96513339dbd2 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 29 Oct 2023 11:05:16 -0700 Subject: [PATCH 3/3] Update FBCustomCommands.m --- WebDriverAgentLib/Commands/FBCustomCommands.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebDriverAgentLib/Commands/FBCustomCommands.m b/WebDriverAgentLib/Commands/FBCustomCommands.m index 0fad267c3..5b1ce72ae 100644 --- a/WebDriverAgentLib/Commands/FBCustomCommands.m +++ b/WebDriverAgentLib/Commands/FBCustomCommands.m @@ -558,7 +558,7 @@ + (NSString *)timeZone id keys = request.arguments[@"keys"]; if (![destination respondsToSelector:@selector(typeKey:modifierFlags:)]) { - NSString *message = @"Not supported on this OS version"; + NSString *message = @"typeKey API is only supported since Xcode15 and iPadOS 17"; return FBResponseWithStatus([FBCommandStatus unsupportedOperationErrorWithMessage:message traceback:nil]); }