public void NavigateToProceedToCheckoutAndClick() { CartPageObjects cpo = new CartPageObjects(); IJavaScriptExecutor js = ((IJavaScriptExecutor)Driver.WebDriver); js.ExecuteScript("arguments[0].click();", cpo.ProceedToCheckoutButton); }
public static void NavigateToProceedToCheckoutAndClick() { try { CartPageObjects cpo = new CartPageObjects(); IJavaScriptExecutor js = ((IJavaScriptExecutor)Driver.WebDriver); js.ExecuteScript("arguments[0].click();", cpo.ProceedToCheckoutButton); } catch (Exception e) { Console.WriteLine(e); } }
public static void CheckoutWithItems() { NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects(); CartPageObjects carp = new CartPageObjects(); WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30)); waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter"))); nav.CartIconCounter.Click(); waitForElement.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[@class='m-product-count-container__flyout-content m-flyout__content js-m-flyout__content m-flyout__content--attached m-flyout__content--dropdown']//span[@class='a-button__inner']"))); nav.CheckoutButton.Click(); Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Your Cart")); carp.NavigateToProceedToCheckoutAndClick(); Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Login")); }
public static void ChangeCountry() { CartPageObjects cpo = new CartPageObjects(); //Driver.WebDriver.Navigate().GoToUrl("https://sculpt.staging.juiceplus.com/ie/en"); NavigationActions.NavigateCountryClick(); //var cartCount = cpo.ShoppingCartIcon.GetAttribute("value"); //try //{ // Assert.That(cartCount, Is.EqualTo("1")); //} //catch (Exception e) //{ // throw; //} }
public static void AddOmegaBlendToCart() { WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30)); NavigationActions.NavigateOurProductsOmegaClick(); OmegaPageObjects opo = new OmegaPageObjects(); CartPageObjects carp = new CartPageObjects(); try { try { Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£")); // Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€")); } catch (Exception e) { Console.WriteLine(e); } LandingPageObjects lan = new LandingPageObjects(); Thread.Sleep(1000); lan.CookieAlertAcceptButton.Click(); Task.Delay(500).Wait(1500); opo.ScrollViewport(); OmegaOrderPageObjects oopo = new OmegaOrderPageObjects(); var NumOfProducts = oopo.NumOfProductOrder.GetAttribute("value"); try { Assert.That(NumOfProducts, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e);; } oopo.IncrementArrowOrder.Click(); var incrProductCount = oopo.NumOfProductOrder.GetAttribute("value"); Thread.Sleep(500); try { Assert.That(incrProductCount, Is.EqualTo("2")); } catch (Exception e) { Console.WriteLine(e); } oopo.DecrementArrowOrder.Click(); var decrProductCount = oopo.NumOfProductOrder.GetAttribute("value"); try { Assert.That(decrProductCount, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } oopo.AddToCartOrder.Click(); NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects(); Thread.Sleep(1000); var NumInCart = nav.CartIconCounter.Text; Console.WriteLine(NumInCart); try { Assert.That(NumInCart, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } nav.CartIconCounter.Click(); waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter"))); nav.CheckoutButton.Click(); carp.NavigateToProceedToCheckoutAndClick(); } catch (ArgumentException e) { Console.WriteLine(e); } }
public static void AddUpliftInstallmentPayCapsulePayInFullRecurringToCart() { try { WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30)); NavigationActions.NavigateOurProductsUpliftClick(); UpliftPageObjects upo = new UpliftPageObjects(); try { Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£")); // Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€")); } catch (Exception e) { Console.WriteLine(e); } LandingPageObjects lan = new LandingPageObjects(); Thread.Sleep(1000); lan.CookieAlertAcceptButton.Click(); Task.Delay(500).Wait(1500); upo.ScrollViewport(); UpliftOrderPageObjects uopo = new UpliftOrderPageObjects(); var NumOfProducts = uopo.NumOfProductOrder.GetAttribute("value"); try { Assert.That(NumOfProducts, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e);; } uopo.IncrementArrowOrder.Click(); var incrProductCount = uopo.NumOfProductOrder.GetAttribute("value"); Thread.Sleep(500); try { Assert.That(incrProductCount, Is.EqualTo("2")); } catch (Exception e) { Console.WriteLine(e); } uopo.DecrementArrowOrder.Click(); var decrProductCount = uopo.NumOfProductOrder.GetAttribute("value"); try { Assert.That(decrProductCount, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } uopo.AddToCartOrder.Click(); NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects(); Thread.Sleep(1000); var NumInCart = nav.CartIconCounter.Text; Console.WriteLine(NumInCart); try { Assert.That(NumInCart, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } nav.CartIconCounter.Click(); waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter"))); nav.CheckoutButton.Click(); CartPageObjects carp = new CartPageObjects(); carp.PayInInstallments.Click(); NavigationActions.NavigateOurProductsCapsulesClick(); CapsulesPageObjects caps = new CapsulesPageObjects(); try { Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£")); Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€")); } catch (Exception e) { Console.WriteLine(e);; } caps.ClickVegetablesAndFruitCapsuleShopNow(); CapsulesOrderPageObjects cpo = new CapsulesOrderPageObjects(); try { Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Fruit & Vegetable Blend Capsules")); } catch (Exception e) { Console.WriteLine(e); } caps.ScrollViewport(); try { Assert.That(NumOfProducts, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e);; } cpo.IncrementArrowOrderCapsules.Click(); Thread.Sleep(500); try { Assert.That(incrProductCount, Is.EqualTo("2")); } catch (Exception e) { Console.WriteLine(e);; } cpo.DecrementArrowOrderCapsules.Click(); try { Assert.That(decrProductCount, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e);; } cpo.AddToCartOrderCapsules.Click(); Thread.Sleep(1000); Console.WriteLine(NumInCart); try { Assert.That(NumInCart, Is.EqualTo("1")); } catch (Exception e) { Console.WriteLine(e); } Thread.Sleep(500); nav.CartIconCounter.Click(); waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter"))); nav.CheckoutButton.Click(); carp.NavigateToProceedToCheckoutAndClick(); } catch (ArgumentException e) { Console.WriteLine(e); } }