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); } }
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); } }
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); } }