示例#1
0
        /// <summary>
        /// The upload picture.
        /// </summary>
        /// <param name="localPathToImage">
        /// The local path to image.
        /// </param>
        /// <returns>
        /// Indication of success.
        /// </returns>
        public bool UploadPicture(string localPathToImage)
        {
            var buttonClickAdminPictures = WebAdapter.ButtonClickByXpath("(//button[@id='but_adm_pic'])[2]");

            if (!buttonClickAdminPictures)
            {
                return(false);
            }

            WebAdapter.WaitForComplete(3);

            // handle the File Upload Dialog
            var nativeDialogFileUpload = WebAdapter.NativeDialogFileUpload(By.Id("userfile"), localPathToImage);

            if (!nativeDialogFileUpload)
            {
                return(false);
            }

            WebAdapter.WaitForComplete(3);

            // Press upload the image
            var buttonClickUploadImage = WebAdapter.ButtonClickById("but_doupload");

            if (!buttonClickUploadImage)
            {
                return(false);
            }

            WebAdapter.WaitForComplete(3);

            return(true);
        }
示例#2
0
        /// <summary>
        /// Upload an profile image
        /// </summary>
        /// <param name="clientSideFilePath">
        /// The client Side File Path.
        /// </param>
        /// <returns>
        /// Inidcation of success
        /// </returns>
        public bool UploadProfileImage(string clientSideFilePath)
        {
            // Visit upload page
            WebAdapter.ButtonClickById("nav_upload_profile");

            // handle the File Upload Dialog
            WebAdapter.NativeDialogFileUpload(By.Name("userfile"), clientSideFilePath);

            var submitButton = WebAdapter.FindElement(By.Id("but_doupload"));

            if (submitButton == null)
            {
                StfLogger.LogError("Couldn't find the upload button");

                return(false);
            }

            submitButton.Click();

            // Back to me again
            var navBack = WebAdapter.FindElement(By.Id("but_back"));

            navBack.Click();

            return(true);
        }
示例#3
0
        /// <inheritdoc />
        /// <summary>
        /// The upload pic.
        /// </summary>
        /// <param name="clientSideFilePath">
        /// The client Side File Path.
        /// </param>
        /// <param name="numUploads">
        /// The number of uploads of picture in clientSideFilePath is going to be performed.
        /// </param>
        /// <returns>
        /// The <see cref="T:System.Boolean" />.
        /// </returns>
        public bool UploadWrapImage(string clientSideFilePath, int numUploads = 1)
        {
            // click the button 'Administrate pictures'
            WebAdapter.ButtonClickById("but_adm_pic");

            for (var i = 1; i <= numUploads; i++)
            {
                WebAdapter.WaitForComplete(3);

                // handle the File Upload Dialog
                WebAdapter.NativeDialogFileUpload(By.Id("userfile"), clientSideFilePath);

                WebAdapter.WaitForComplete(3);

                // Press upload the image
                WebAdapter.ButtonClickById("but_doupload");
            }

            WebAdapter.WaitForComplete(3);

            return(true);
        }