Esempio n. 1
0
        public void InputPaymentMethod(String creditCardType, String creditCardNumber, String expMonth, String expYear, String cvv)
        {
            SelectElement CreditCardTypeDropdown     = new SelectElement(CreditCardType);
            SelectElement CreditCardExpMonthDropdown = new SelectElement(CreditCardExpMonth);
            SelectElement CreditCardExpYearDropdown  = new SelectElement(CreditCardExpYear);

            CreditCardTypeDropdown.SelectByText(creditCardType);
            CreditCardNumber.SendKeys(creditCardNumber);
            CreditCardExpMonthDropdown.SelectByValue(expMonth);
            CreditCardExpYearDropdown.SelectByValue(expYear);

            double initialImplicitWaitTime = Driver.WebDriver.Manage().Timeouts().ImplicitWait.TotalSeconds;

            try
            {
                Driver.WebDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(0);
                CreditCardCVV.SendKeys(cvv);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                Driver.WebDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(initialImplicitWaitTime);
            }

            PaymentMethodContinueButton.Click();
        }
Esempio n. 2
0
        public void InputPaymentMethod(String creditCardType, String creditCardNumber, String expMonth, String expYear, String cvv)
        {
            // WaitUntilElementVisible(By.XPath("//p[contains(text(),'How would you like to pay?')]"), 15);
            WaitUntilElementVisible(By.Id("formCart"), 15);

            SelectElement CreditCardTypeDropdown     = new SelectElement(CreditCardType);
            SelectElement CreditCardExpMonthDropdown = new SelectElement(CreditCardExpMonth);
            SelectElement CreditCardExpYearDropdown  = new SelectElement(CreditCardExpYear);

            CreditCardTypeDropdown.SelectByText(creditCardType);
            CreditCardNumber.SendKeys(creditCardNumber);
            CreditCardExpMonthDropdown.SelectByValue(expMonth);
            CreditCardExpYearDropdown.SelectByValue(expYear);

            double initialImplicitWaitTime = Driver.WebDriver.Manage().Timeouts().ImplicitWait.TotalSeconds;

            try
            {
                Driver.WebDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(0);
                CreditCardCVV.SendKeys(cvv);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                Driver.WebDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(initialImplicitWaitTime);
            }

            /*try
             * {
             *  CheckoutPage.CreditCardCVV.SendKeys(cvv);
             * }
             * catch (Exception e)
             * {
             *  Console.WriteLine(e);
             * }*/

            PaymentMethodContinueButton.Click();
        }