public void NavigateToFileVerifyBackForwardAndRefreshTest() { Browser.Navigate.ToFile($@"{BasePath}\{AmazonHome}"); // VerifyBase Navigate.ToFile(). var originalUrl = Browser.Url; CartButton.Click(); var nextUrl = Browser.Url; Browser.Verify.Contains("cart", nextUrl); Browser.Navigate.Back(); Browser.Verify.Equal(originalUrl, Browser.Url); // VerifyBase Navigate.Back(). Browser.Navigate.Forward(); Browser.Verify.Equal(nextUrl, Browser.Url); // VerifyBase Navigate.Forward(). var cartButton = CartButton; Browser.Verify.True(cartButton.Displayed); Browser.Navigate.Refresh(); Assert.Throws <StaleElementReferenceException>(() => cartButton.Displayed); // VerifyBase Navigate.Refresh(). }
public void RemoveFromCart() { if (!CanRemoveFromCart()) { throw new InvalidElementStateException(); } CartButton.Click(); }
public void AddToCart() { if (!CanAddToCart()) { throw new InvalidElementStateException(); } CartButton.Click(); }
void ReleaseDesignerOutlets() { if (CartButton != null) { CartButton.Dispose(); CartButton = null; } if (ChatButton != null) { ChatButton.Dispose(); ChatButton = null; } if (MyLibraryButton != null) { MyLibraryButton.Dispose(); MyLibraryButton = null; } if (NotificationsButton != null) { NotificationsButton.Dispose(); NotificationsButton = null; } if (ProfileButton != null) { ProfileButton.Dispose(); ProfileButton = null; } if (ProfileButton2 != null) { ProfileButton2.Dispose(); ProfileButton2 = null; } if (ProfilePic != null) { ProfilePic.Dispose(); ProfilePic = null; } if (ProfilePicButton != null) { ProfilePicButton.Dispose(); ProfilePicButton = null; } }
private async void TypeCart(CartButton obj) { if (current != null) { current.IsSelected = false; } current = obj; current.IsSelected = true; foreach (var item in ToolbarTitle) { if (item != obj) { item.IsSelected = false; } } if (obj.Type == CartEnum.Pending_Orders) { await NavigationService.NavigateAsync(Routes.ShippingReview); } }
public void ValidateProductsChosen() { Helper.ScrollToSeeTheRightButton(_driver, FirstBlouse); FirstBlouse.Click(); _driver.SwitchTo().Frame(_driver.FindElement(By.XPath("//iframe[@src='http://automationpractice.com/index.php?id_product=2&controller=product&content_only=1']"))); FirstBlouseBigImage.Click(); Helper.ScrollToSeeTheRightButton(_driver, AddToCartButton); AddToCartButton.Click(); Thread.Sleep(2000); ContinueShoppingButton.Click(); Actions actions = new Actions(_driver); IWebElement target = DressesTab; actions.MoveToElement(target).Perform(); SummerDressesSubMenu.Click(); Helper.ScrollToSeeTheRightButton(_driver, ThirdDress); ThirdDress.Click(); _driver.SwitchTo().Frame(_driver.FindElement(By.XPath("//iframe[@src='http://automationpractice.com/index.php?id_product=7&controller=product&content_only=1']"))); ThirdDressBigImage.Click(); Helper.ScrollToSeeTheRightButton(_driver, AddToCartButton); AddToCartButton.Click(); Thread.Sleep(3000); ContinueShoppingButton.Click(); Helper.ScrollToSeeTheRightButton(_driver, TshirtsTab); TshirtsTab.Click(); Helper.ScrollToSeeTheRightButton(_driver, FirstTshirt); FirstTshirt.Click(); _driver.SwitchTo().Frame(_driver.FindElement(By.XPath("//iframe[@src='http://automationpractice.com/index.php?id_product=1&controller=product&content_only=1']"))); FirstTshirtBigImage.Click(); Helper.ScrollToSeeTheRightButton(_driver, AddToCartButton); AddToCartButton.Click(); Thread.Sleep(3000); CheckoutButton.Click(); Helper.ScrollToSeeTheRightButton(_driver, CartButton); CartButton.Click(); }
void AddItem(Item item) { if (itemsInCart.ContainsKey(item)) { itemsInCart[item] += 1; } else { itemsInCart.Add(item, 1); CartButton newCartButton = Instantiate(cartButton, cartPanel).GetComponent <CartButton>(); cartButtons.Add(item, newCartButton); cartButtons[item].Init(item); } cartButtons[item].UpdateInfo(item, itemsInCart[item]); totalPrice += item.price; if (OnAddInCart != null) { OnAddInCart(item, totalPrice); } }
public void ClickCartButton() { CartButton.Click(); }