public void AddAttachment(string strFullFilePath, string strFilename)
        {
            if (!strFullFilePath.Equals("") && !strFilename.Equals(""))
            {
                try
                {
                    if (null != _attachFile)
                    {
                        _attachFile.SendKeys(strFullFilePath);
                        _actionsBuilder.SendKeys(Keys.Enter);

                        By attachmentInfo = By.XPath($"//input[contains(@value,'{strFilename}')]");
                        _isAttachmentComplete = _wait.Until(ExpectedConditions.TextToBePresentInElementValue(attachmentInfo, strFilename));

                        ProcessUtils.ConsoleLog($"Attach File Complete: {_isAttachmentComplete}");
                    }
                    else
                    {
                        ProcessUtils.ConsoleLog("ERROR: Input Attach File Path Not Found");
                    }
                }
                catch (WebDriverTimeoutException timeout)
                {
                    ProcessUtils.ConsoleLog(timeout.Message);
                }
            }
            else
            {
                ProcessUtils.ConsoleLog("No ATTACHMENT provided");
            }
        }
        public void GoToInbox(string strCategory)
        {
            if (!strCategory.Equals(""))
            {
                try
                {
                    switch (strCategory)
                    {
                    case "Social":
                        if (null != _socialCategoryTabElement)
                        {
                            _actionsBuilder.MoveToElement(_socialCategoryTabElement)
                            .Click()
                            .Build()
                            .Perform();
                        }
                        break;

                    default:
                        break;
                    }
                }
                catch (WebDriverTimeoutException ex)
                {
                    ProcessUtils.ConsoleLog(ex.Message);
                }
            }
            else
            {
                ProcessUtils.ConsoleLog("No CATEGORY provided.");
            }
        }
예제 #3
0
 private void ClickNextForLogin()
 {
     try
     {
         _wait.Until(ExpectedConditions.ElementToBeClickable(_nextButtonLogin)).Click();
     }
     catch (WebDriverTimeoutException timeout)
     {
         ProcessUtils.ConsoleLog(timeout.Message);
     }
 }
예제 #4
0
 private void TypePassword(string password)
 {
     try
     {
         _wait.Until(ExpectedConditions.ElementToBeClickable(_passwordInput)).SendKeys(password);
     }
     catch (WebDriverTimeoutException timeout)
     {
         ProcessUtils.ConsoleLog(timeout.Message);
     }
 }
예제 #5
0
 private void TypeUsername(string username)
 {
     try
     {
         _wait.Until(ExpectedConditions.ElementToBeClickable(_usernameInput)).SendKeys(username);
     }
     catch (WebDriverTimeoutException timeout)
     {
         ProcessUtils.ConsoleLog(timeout.Message);
     }
 }
예제 #6
0
        public void ClickOnEmailBasedOnSubject(string strSubject)
        {
            _email = SearchMailBySubject(strSubject);

            if (null != _email)
            {
                _actionsBuilder.MoveToElement(_email)
                .Click()
                .Build()
                .Perform();

                _browserDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
            }
            else
            {
                ProcessUtils.ConsoleLog("ERROR: No messages matched your search.");
            }
        }
예제 #7
0
        public bool IsAttachmentFound(string strFilename)
        {
            try
            {
                IWebElement attachment = _wait.Until(ExpectedConditions.ElementExists(By.XPath($"//span[text()='{strFilename}']")));
                if (null != attachment)
                {
                    Console.WriteLine($"attachment.Text: {attachment.Text}, strSender: {strFilename}");
                    return(attachment.Text.Equals(strFilename));
                }
            }
            catch (WebDriverTimeoutException timeout)
            {
                ProcessUtils.ConsoleLog(timeout.Message);
            }

            return(false);
        }
예제 #8
0
        public bool IsBodyMatching(string strMsgBody)
        {
            try
            {
                IWebElement messageBody = _wait.Until(ExpectedConditions.ElementExists(By.XPath($"//div[text()='{strMsgBody}']")));
                if (null != messageBody)
                {
                    Console.WriteLine($"messageBody.Text: {messageBody.Text}, strSender: {strMsgBody}");
                    return(messageBody.Text.Equals(strMsgBody));
                }
            }
            catch (WebDriverTimeoutException timeout)
            {
                ProcessUtils.ConsoleLog(timeout.Message);
            }

            return(false);
        }
예제 #9
0
        public bool IsSenderMatching(string strSender)
        {
            try
            {
                IWebElement senderElement = _wait.Until(ExpectedConditions.ElementExists(By.XPath($"//h3//span[@email='{strSender}']")));

                if (null != senderElement)
                {
                    Console.WriteLine($"senderElement.GetAttribute('email'): {senderElement.GetAttribute("email")}, strSender: {strSender}");
                    return(senderElement.GetAttribute("email").Equals(strSender));
                }
            }
            catch (WebDriverTimeoutException timeout)
            {
                ProcessUtils.ConsoleLog(timeout.Message);
            }

            return(false);
        }
예제 #10
0
        public void ClickOnViewMessageLink()
        {
            try
            {
                if (null != _wait.Until(ExpectedConditions.ElementToBeClickable(_viewMessageLink)))
                {
                    _actionsBuilder.MoveToElement(_viewMessageLink)
                    .Click()
                    .Build()
                    .Perform();

                    _browserDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
                }
            }
            catch (WebDriverTimeoutException timeout)
            {
                ProcessUtils.ConsoleLog(timeout.Message);
            }
        }
 public void ClickComposeButton()
 {
     try
     {
         if (null != _wait.Until(ExpectedConditions.ElementToBeClickable(_composeButton)))
         {
             _composeButton.Click();
             _wait.Until(ExpectedConditions.TextToBePresentInElement(_newMessageDialog, "New Message"));
         }
         else
         {
             ProcessUtils.ConsoleLog("ERROR: COMPOSE Button Not Available");
         }
     }
     catch (WebDriverTimeoutException timeout)
     {
         ProcessUtils.ConsoleLog(timeout.Message);
     }
 }
        private void ClickSendButton()
        {
            if (null != _wait.Until(ExpectedConditions.ElementToBeClickable(_sendButtonElement)))
            {
                _actionsBuilder.MoveToElement(_sendButtonElement);
                _actionsBuilder.Click()
                .Perform();
            }
            else
            {
                ProcessUtils.ConsoleLog("ERROR: Send Button Not Available");
            }

            IWebElement messageSentInfo = _wait.Until(ExpectedConditions.ElementExists(By.XPath("//span[text()='Message sent.']")));

            _isMessageSent = _wait.Until(ExpectedConditions.TextToBePresentInElement(messageSentInfo, "Message sent."));

            ProcessUtils.ConsoleLog($"Message Sent: {_isMessageSent}");
        }
 public void SetMessageBody(string strMessageBody)
 {
     try
     {
         if (null != _wait.Until(ExpectedConditions.ElementToBeClickable(_messageBody)))
         {
             _messageBody.Clear();
             _messageBody.SendKeys(strMessageBody);
         }
         else
         {
             ProcessUtils.ConsoleLog("ERROR: New Message Body Field Not Found");
         }
     }
     catch (WebDriverTimeoutException timeout)
     {
         ProcessUtils.ConsoleLog(timeout.Message);
     }
 }
 private void SetReceiverField(string strReceiver)
 {
     try
     {
         if (null != _wait.Until(ExpectedConditions.ElementToBeClickable(_receiverField)))
         {
             _receiverField.Clear();
             _receiverField.SendKeys(strReceiver);
         }
         else
         {
             ProcessUtils.ConsoleLog("ERROR: New Message Receiver Field Not Found");
         }
     }
     catch (WebDriverTimeoutException timeout)
     {
         ProcessUtils.ConsoleLog(timeout.Message);
     }
 }
예제 #15
0
        public bool IsLabelApplied(string strLabel)
        {
            try
            {
                foreach (IWebElement labelCheckbox in _browserDriver.FindElements(By.XPath($"//*[@role='menuitemcheckbox' and @title='{strLabel}']")))
                {
                    Console.WriteLine($"labelCheckbox.GetAttribute('aria-checked'): {labelCheckbox.GetAttribute("aria-checked")}");
                    if (labelCheckbox.GetAttribute("aria-checked").Equals("true"))
                    {
                        return(true);
                    }
                }
            }
            catch (WebDriverTimeoutException timeout)
            {
                ProcessUtils.ConsoleLog(timeout.Message);
            }

            return(false);
        }
 private void LabelWithCategory(string strCategory)
 {
     if (!strCategory.Equals(""))
     {
         if (null != _moreOptions)
         {
             _moreOptions.Click();
             _labelMenu = PageFactory.InitElements <LabelMenu>(_browserDriver);
             _labelMenu.LabelWithCategory(strCategory);
             _isLabelApplied = _labelMenu.IsLabelCategoryChecked(strCategory);
         }
         else
         {
             ProcessUtils.ConsoleLog("ERROR: More Options button not available");
         }
     }
     else
     {
         ProcessUtils.ConsoleLog("No CATEGORY LABEL provided.");
     }
 }