Esempio n. 1
0
        internal void EnterEmailAndPassword(Table table)
        {
            var    valuesFromTable = table.CreateDynamicSet();
            string password        = valuesFromTable.First().password;
            string email           = valuesFromTable.First().email;

            if (email.Equals("random"))
            {
                email = CreateRandomEmail();
            }

            Logger.Info($"Email is: {email}; Password: {password}");
            bool IsNextButtonVisible = true;

            do
            {
                try
                {
                    wait.Until(ElementDisplayed(EmailTextBox));
                }
                catch (WebDriverTimeoutException)
                {
                    Logger.Warn("Text box not found");
                }
                TextBoxHelper.ClickAndTypeInTextBox(EmailTextBox, email);
                ButtonHelper.ClickButton(NextButton);
                Thread.Sleep(1000);
                try
                {
                    wait.Until(ElementDisplayed(NextButton));
                    if (!NextButton.Displayed)
                    {
                        IsNextButtonVisible = false;
                    }
                }
                catch (Exception)
                {
                    IsNextButtonVisible = false;
                }
            } while (IsNextButtonVisible);

            try
            {
                wait.Until(ElementDisplayed(PasswordTextBox));
                TextBoxHelper.ClickAndTypeInTextBox(PasswordTextBox, password);
            }
            catch (Exception)
            {
                Logger.Warn("Password box not found");
            }
            LogInButton.Click();
            NotificationText = IncorrectTextErrorNotification.Text;
        }
Esempio n. 2
0
        internal void EnterPhoneNumber()
        {
            var  phoneNo             = CreateRandomNumberUsingUnixTimeStamp();
            bool IsNextButtonVisible = true;

            do
            {
                try
                {
                    wait.Until(ElementDisplayed(EmailTextBox));
                }
                catch (WebDriverTimeoutException)
                {
                    Logger.Warn("Text box not found");
                }
                TextBoxHelper.ClickAndTypeInTextBox(EmailTextBox, phoneNo.ToString());
                ButtonHelper.ClickButton(NextButton);
                Thread.Sleep(1000);

                //check if warning has appeared
                try
                {
                    if (_driver.FindElements(By.XPath("(//p[@class='notification notification-warning'])[1]")).Count == 1)
                    {
                        NotificationText = _driver.FindElement(By.XPath("(//p[@class='notification notification-warning'])[1]")).Text;
                        Logger.Info($"Notification text set to: {NotificationText}");
                        return;
                    }
                }
                catch (Exception)
                {
                    Logger.Info("Warning has not appeared");
                }

                try
                {
                    wait.Until(ElementDisplayed(NextButton));
                    if (!NextButton.Displayed)
                    {
                        IsNextButtonVisible = false;
                    }
                }
                catch (Exception)
                {
                    IsNextButtonVisible = false;
                }
            } while (IsNextButtonVisible);
        }