Beispiel #1
0
        void RegistrationPremium(MainWindow mainWindow, Models.Account account)
        {
            Random random = new Random();

            Thread.Sleep(random.Next(10000, 15000));

            _driver.Navigate().GoToUrl(mainWindow.RegisterPremium.Url);
            var cardInfo = StringHelper.GetCardInfo(account.CardContact);

            Thread.Sleep(random.Next(10000, 15000));

            _driver.SwitchTo().Frame(_driver.FindElementWait(mainWindow.RegisterPremium.IFrame, 10));
            Thread.Sleep(random.Next(1000, 2000));

            var cardNumberElement = _driver.FindElementWait(mainWindow.RegisterPremium.CardNumber);

            _driver.FillTextToTextBox(cardNumberElement, cardInfo.CardNumber);
            Thread.Sleep(random.Next(1000, 2000));

            var expiryMonthElement = _driver.FindElementWait(mainWindow.RegisterPremium.ExpiryMonth);
            var selectMonthElement = new SelectElement(expiryMonthElement);

            selectMonthElement.SelectByText(cardInfo.ExpiryMonth);
            Thread.Sleep(random.Next(1000, 2000));

            var expiryYearElement = _driver.FindElementWait(mainWindow.RegisterPremium.ExpiryYear);
            var selectYearElement = new SelectElement(expiryYearElement);

            selectYearElement.SelectByText(cardInfo.ExpiryYear);
            Thread.Sleep(random.Next(1000, 2000));

            var secureCodeElement = _driver.FindElementWait(mainWindow.RegisterPremium.SecurityCode);

            _driver.FillTextToTextBox(secureCodeElement, cardInfo.SecurityCode);
            Thread.Sleep(random.Next(1000, 2000));

            var zipCodeElement = _driver.FindElementWait(mainWindow.RegisterPremium.ZipCode);

            _driver.FillTextToTextBox(zipCodeElement, cardInfo.ZipCode);
            Thread.Sleep(random.Next(1000, 2000));

            var submitElement = _driver.FindElementWait(mainWindow.RegisterPremium.ZipCode);

            _driver.ClickElement(submitElement);

            Thread.Sleep(random.Next(10000, 15000));
        }