Exemplo n.º 1
0
        public static string GetClipboardUrl(IExecuteMethod executeMethod)
        {
            var content         = AppiumCommandExecutionHelper.GetClipboard(executeMethod, ClipboardContentType.Url);
            var urlEncodedBytes = Convert.FromBase64String(content);
            var urlDecodedBytes = Encoding.UTF8.GetString(urlEncodedBytes);

            return(WebUtility.UrlDecode(urlDecodedBytes));
        }
Exemplo n.º 2
0
        public static Image GetClipboardImage(IExecuteMethod executeMethod)
        {
            var imageBytes = Convert.FromBase64String(
                AppiumCommandExecutionHelper.GetClipboard(executeMethod, ClipboardContentType.Image));

            if (imageBytes.Length > 0)
            {
                return(Image.FromStream(new MemoryStream(imageBytes)));
            }

            return(null);
        }
 /// <summary>
 /// Get the content of the clipboard.
 /// </summary>
 /// <param name="contentType"></param>
 /// <remarks>Android supports plaintext only</remarks>
 /// <returns>The content of the clipboard as base64-encoded string or an empty string if the clipboard is empty</returns>
 public string GetClipboard(ClipboardContentType contentType) => AppiumCommandExecutionHelper.GetClipboard(this, contentType);