Beispiel #1
0
        public static void SelectProduct()
        {
            try
            {
                SeleniumSetMethod.ElementPresent(btnGoToProduct);
                SeleniumSetMethod.ElementEnabled(btnGoToProduct);
                SeleniumSetMethod.Clicks(btnGoToProduct);

                string urlSelectedProduct = WebDriver.driver.Url;
                SeleniumSetMethod.WaitForPageToLoad(WebDriver.driver, 50);
                SeleniumGetMethods.PageLoaded(urlSelectedProduct, "product");
                Console.WriteLine("Viewing product successful!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Viewing product failed: {0}", e);
            }
        }
        public static void GoToPayment()
        {
            try
            {
                SeleniumSetMethod.ElementPresent(chcbxIAgree);
                SeleniumSetMethod.ElementEnabled(chcbxIAgree);
                SeleniumSetMethod.CheckBox(chcbxIAgree);

                SeleniumSetMethod.ElementPresent(btnProccedToPayment);
                SeleniumSetMethod.ElementEnabled(btnProccedToPayment);
                SeleniumSetMethod.Clicks(btnProccedToPayment);

                string urlAdress = WebDriver.driver.Url;
                SeleniumSetMethod.WaitForPageToLoad(WebDriver.driver, 35);
                SeleniumGetMethods.PageLoaded(urlAdress, "shipping");
                Console.WriteLine("Procceded to payment successfully!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Adding Product quantity failed: {0}", e);
            }
        }
Beispiel #3
0
        public static void AddToCart()
        {
            try
            {
                SeleniumSetMethod.ElementPresent(btnAddToCart);
                SeleniumSetMethod.ElementEnabled(btnAddToCart);
                SeleniumSetMethod.Clicks(btnAddToCart);
                Thread.Sleep(3000);

                SeleniumSetMethod.ElementPresent(btnGoToCheckout);
                SeleniumSetMethod.ElementEnabled(btnGoToCheckout);
                SeleniumSetMethod.Clicks(btnGoToCheckout);

                string urlShoppingCart = WebDriver.driver.Url;
                SeleniumSetMethod.WaitForPageToLoad(WebDriver.driver, 35);
                SeleniumGetMethods.PageLoaded(urlShoppingCart, "order");
                Console.WriteLine("Product added successfully!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Adding product failed: {0}", e);
            }
        }
        public static void AddQuantity(string quantity)
        {
            try
            {
                SeleniumSetMethod.ElementPresent(txtEnterQuantity);
                SeleniumSetMethod.ElementEnabled(txtEnterQuantity);
                txtEnterQuantity.Clear();
                SeleniumSetMethod.ElementEmpty(txtEnterQuantity);
                SeleniumSetMethod.EnterText(txtEnterQuantity, quantity);

                SeleniumSetMethod.ElementPresent(btnProcedToCheckout);
                SeleniumSetMethod.ElementEnabled(btnProcedToCheckout);
                SeleniumSetMethod.Clicks(btnProcedToCheckout);

                string urlAdress = WebDriver.driver.Url;
                SeleniumSetMethod.WaitForPageToLoad(WebDriver.driver, 35);
                SeleniumGetMethods.PageLoaded(urlAdress, "order");
                Console.WriteLine("Product quantity increased successfully!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Adding Product quantity failed: {0}", e);
            }
        }
        public static void AddComment(string comment)
        {
            try
            {
                SeleniumSetMethod.ElementPresent(txtComment);
                SeleniumSetMethod.ElementEnabled(txtComment);
                txtComment.Clear();
                SeleniumSetMethod.ElementEmpty(txtComment);
                SeleniumSetMethod.EnterText(txtComment, comment);

                SeleniumSetMethod.ElementPresent(btnProcedToAddress);
                SeleniumSetMethod.ElementEnabled(btnProcedToAddress);
                SeleniumSetMethod.Clicks(btnProcedToAddress);

                string urlAdress = WebDriver.driver.Url;
                SeleniumSetMethod.WaitForPageToLoad(WebDriver.driver, 50);
                SeleniumGetMethods.PageLoaded(urlAdress, "order");
                Console.WriteLine("Comment added successfully!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Adding comment failed: {0}", e);
            }
        }