@@ -85,6 +85,8 @@ public static bool IsKeyboardShown(IExecuteMethod executeMethod)
85
85
public static void SetClipboard ( IExecuteMethod executeMethod , ClipboardContentType clipboardContentType ,
86
86
string base64Content )
87
87
{
88
+ var contentType = clipboardContentType . ToString ( ) . ToLowerInvariant ( ) ;
89
+
88
90
switch ( clipboardContentType )
89
91
{
90
92
case ClipboardContentType . Image :
@@ -97,18 +99,19 @@ public static void SetClipboard(IExecuteMethod executeMethod, ClipboardContentTy
97
99
98
100
executeMethod . Execute ( AppiumDriverCommand . SetClipboard ,
99
101
PrepareArguments ( new [ ] { "content" , "contentType" , "label" } ,
100
- new object [ ] { base64Content , clipboardContentType . ToString ( ) . ToLower ( ) , null } ) ) ;
102
+ new object [ ] { base64Content , contentType , null } ) ) ;
101
103
break ;
102
104
default :
103
105
executeMethod . Execute ( AppiumDriverCommand . SetClipboard ,
104
106
PrepareArguments ( new [ ] { "content" , "contentType" , "label" } ,
105
- new object [ ] { base64Content , clipboardContentType . ToString ( ) . ToLower ( ) , null } ) ) ;
107
+ new object [ ] { base64Content , contentType , null } ) ) ;
106
108
break ;
107
109
}
108
110
}
109
111
110
112
public static string GetClipboard ( IExecuteMethod executeMethod , ClipboardContentType clipboardContentType )
111
113
{
114
+ var contentType = clipboardContentType . ToString ( ) . ToLowerInvariant ( ) ;
112
115
switch ( clipboardContentType )
113
116
{
114
117
case ClipboardContentType . Image :
@@ -118,15 +121,12 @@ public static string GetClipboard(IExecuteMethod executeMethod, ClipboardContent
118
121
throw new NotImplementedException (
119
122
$ "Android only supports contentType: { nameof ( ClipboardContentType . PlainText ) } ") ;
120
123
}
121
-
122
- return ( string ) executeMethod . Execute ( AppiumDriverCommand . GetClipboard ,
123
- PrepareArgument ( "contentType" , clipboardContentType . ToString ( ) . ToLower ( ) ) ) . Value ;
124
- case ClipboardContentType . PlainText :
125
124
return ( string ) executeMethod . Execute ( AppiumDriverCommand . GetClipboard ,
126
- PrepareArgument ( "contentType" , clipboardContentType . ToString ( ) . ToLower ( ) ) ) . Value ;
125
+ PrepareArgument ( "contentType" , contentType ) ) . Value ;
127
126
default :
127
+ // including ClipboardContentType.PlainText
128
128
return ( string ) executeMethod . Execute ( AppiumDriverCommand . GetClipboard ,
129
- PrepareArgument ( "contentType" , clipboardContentType . ToString ( ) . ToLower ( ) ) ) . Value ;
129
+ PrepareArgument ( "contentType" , contentType ) ) . Value ;
130
130
}
131
131
}
132
132
@@ -144,7 +144,7 @@ public static string SetClipboardText(IExecuteMethod executeMethod, string textC
144
144
new object [ ]
145
145
{
146
146
Convert . ToBase64String ( encodedStringContentBytes ) ,
147
- ClipboardContentType . PlainText . ToString ( ) . ToLower ( ) , label
147
+ ClipboardContentType . PlainText . ToString ( ) . ToLowerInvariant ( ) , label
148
148
} ) ) . Value ;
149
149
}
150
150
@@ -214,4 +214,4 @@ internal static Dictionary<string, object> PrepareArguments(string[] names, obje
214
214
return parameterBuilder ;
215
215
}
216
216
}
217
- }
217
+ }
0 commit comments