Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Appium.Net/Appium/AppiumCommandExecutionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public static bool IsKeyboardShown(IExecuteMethod executeMethod)
public static void SetClipboard(IExecuteMethod executeMethod, ClipboardContentType clipboardContentType,
string base64Content)
{
var contentType = clipboardContentType.ToString().ToLowerInvariant();

switch (clipboardContentType)
{
case ClipboardContentType.Image:
Expand All @@ -97,18 +99,19 @@ public static void SetClipboard(IExecuteMethod executeMethod, ClipboardContentTy

executeMethod.Execute(AppiumDriverCommand.SetClipboard,
PrepareArguments(new[] {"content", "contentType", "label"},
new object[] {base64Content, clipboardContentType.ToString().ToLower(), null}));
new object[] {base64Content, contentType, null}));
break;
default:
executeMethod.Execute(AppiumDriverCommand.SetClipboard,
PrepareArguments(new[] {"content", "contentType", "label"},
new object[] {base64Content, clipboardContentType.ToString().ToLower(), null}));
new object[] {base64Content, contentType, null}));
break;
}
}

public static string GetClipboard(IExecuteMethod executeMethod, ClipboardContentType clipboardContentType)
{
var contentType = clipboardContentType.ToString().ToLowerInvariant();
switch (clipboardContentType)
{
case ClipboardContentType.Image:
Expand All @@ -118,15 +121,12 @@ public static string GetClipboard(IExecuteMethod executeMethod, ClipboardContent
throw new NotImplementedException(
$"Android only supports contentType: {nameof(ClipboardContentType.PlainText)}");
}

return (string) executeMethod.Execute(AppiumDriverCommand.GetClipboard,
PrepareArgument("contentType", clipboardContentType.ToString().ToLower())).Value;
case ClipboardContentType.PlainText:
return (string) executeMethod.Execute(AppiumDriverCommand.GetClipboard,
PrepareArgument("contentType", clipboardContentType.ToString().ToLower())).Value;
PrepareArgument("contentType", contentType)).Value;
default:
// including ClipboardContentType.PlainText
return (string) executeMethod.Execute(AppiumDriverCommand.GetClipboard,
PrepareArgument("contentType", clipboardContentType.ToString().ToLower())).Value;
PrepareArgument("contentType", contentType)).Value;
}
}

Expand All @@ -144,7 +144,7 @@ public static string SetClipboardText(IExecuteMethod executeMethod, string textC
new object[]
{
Convert.ToBase64String(encodedStringContentBytes),
ClipboardContentType.PlainText.ToString().ToLower(), label
ClipboardContentType.PlainText.ToString().ToLowerInvariant(), label
})).Value;
}

Expand Down Expand Up @@ -214,4 +214,4 @@ internal static Dictionary<string, object> PrepareArguments(string[] names, obje
return parameterBuilder;
}
}
}
}