Пример #1
0
 public SelectProductPage()
 {
     searchPage        = new UIHelper.SearchPage();
     homePage          = new HomePage();
     seleniumSetMethod = new SeleniumSetMethod();
     selectProductPage = new UIHelper.SelectProductPage();
 }
Пример #2
0
        public static void LogIn(string emailadress, string password)
        {
            try
            {
                SeleniumSetMethod.ElementPresent(txtEmailAdress);
                SeleniumSetMethod.ElementEnabled(txtEmailAdress);
                SeleniumSetMethod.ElementEmpty(txtEmailAdress);
                txtEmailAdress.Clear();
                SeleniumSetMethod.EnterText(txtEmailAdress, emailadress);

                SeleniumSetMethod.ElementPresent(txtPassword);
                SeleniumSetMethod.ElementEnabled(txtPassword);
                SeleniumSetMethod.ElementEmpty(txtPassword);
                txtPassword.Clear();
                SeleniumSetMethod.EnterText(txtPassword, password);

                SeleniumSetMethod.ElementPresent(btnSignIn);
                SeleniumSetMethod.ElementEnabled(btnSignIn);
                SeleniumSetMethod.Submits(btnSignIn);

                string urlSearch = WebDriver.driver.Url;
                SeleniumSetMethod.WaitForPageToLoad(WebDriver.driver, 35);
                SeleniumGetMethods.PageLoaded(urlSearch, "account");
                Console.WriteLine("Login successful!");
            }
            catch (Exception e)
            {
                Console.WriteLine("LogIn failed: {0}", e);
            }
        }
Пример #3
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);
            }
        }
Пример #4
0
        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);
            }
        }
Пример #5
0
        public static void EnterProduct(string search)
        {
            try
            {
                SeleniumSetMethod.ElementPresent(txtSearch);
                SeleniumSetMethod.ElementEnabled(txtSearch);
                SeleniumSetMethod.ElementEmpty(txtSearch);
                SeleniumSetMethod.EnterText(txtSearch, search);

                SeleniumSetMethod.ElementPresent(btnSearch);
                SeleniumSetMethod.ElementEnabled(btnSearch);
                SeleniumSetMethod.Submits(btnSearch);

                string urlProducts = WebDriver.driver.Url;
                SeleniumSetMethod.WaitForPageToLoad(WebDriver.driver, 50);
                SeleniumGetMethods.PageLoaded(urlProducts, "shirt");
                Console.WriteLine("Search successful!");
            }
            catch (Exception e)
            {
                Console.WriteLine("Search failed: {0}", e);
            }
        }
Пример #6
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);
            }
        }
Пример #8
0
        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);
            }
        }
Пример #9
0
 public LoginPage()
 {
     homePage          = new UIHelper.HomePage();
     loginPage         = new UIHelper.LoginPage();
     seleniumSetMethod = new SeleniumSetMethod();
 }