public void NavigateToAsusCategoryInLaptopsSection() { string expectedText = "Ноутбуки Asus"; RozetkaPage rozetkaPage = new RozetkaPage(driver); Actions actions = new Actions(driver); WebElementHelpers webElementHelpers = new WebElementHelpers(); webElementHelpers.WaitElement(driver, rozetkaPage.LaptopsAndComputers, 10); actions.MoveToElement(rozetkaPage.LaptopsAndComputers).Perform(); webElementHelpers.WaitElement(driver, rozetkaPage.AsusFromLaptopsSection, 10); rozetkaPage.AsusFromLaptopsSection.Click(); string actualText = driver.FindElement(By.CssSelector("h1")).GetAttribute("innerText"); Assert.True(expectedText == actualText, $"Test Failed, because {expectedText} doesn't equal {actualText}. Please check."); }
public void OutputTextToConsoleFromOpenCart() { RozetkaPage rozetkaPage = new RozetkaPage(driver); Actions actions = new Actions(driver); WebElementHelpers webElementHelpers = new WebElementHelpers(); webElementHelpers.WaitElement(driver, rozetkaPage.OpenCart, 10); actions.MoveToElement(rozetkaPage.OpenCart).Perform(); string textFromCartForCw = driver.FindElement(By.XPath("//li[4]/div/div[1]/div/div/div[2]/p[@class='header-actions__dummy-text']")).GetAttribute("innerText"); Console.WriteLine(textFromCartForCw); }
public void CountOfElementsWithFreeShipping() { HeaderOfEtsyCom headerOfEtsyCom = new HeaderOfEtsyCom(driver); Actions actions = new Actions(driver); WebElementHelpers webElementHelperes = new WebElementHelpers(); actions.MoveToElement(headerOfEtsyCom.ClothingAndShoes).Perform(); webElementHelperes.WaitElement(driver, headerOfEtsyCom.ClothingAndShoesMens, 10); actions.MoveToElement(headerOfEtsyCom.ClothingAndShoesMens).Perform(); headerOfEtsyCom.ClothingAndShoesMensBoots.Click(); int freeShippingElements = webElementHelperes.CountOfElements(driver, By.XPath("//*[@class='text-body-smaller no-wrap']")); int freeShippingWithDiscountElements = webElementHelperes.CountOfElements(driver, By.XPath("//*[@class='text-body-smaller text-truncate']")); int freeShippingGeneralCount = freeShippingElements + freeShippingWithDiscountElements; Console.WriteLine(freeShippingGeneralCount); }
public void FindItemsWithDiscountAndCheckThatOldPriceAndDiscountMarkedGreenColor() { string expectedColour = "rgba(46, 133, 57, 1)"; HeaderOfEtsyCom headerOfEtsyCom = new HeaderOfEtsyCom(driver); Actions actions = new Actions(driver); WebElementHelpers webElementHelperes = new WebElementHelpers(); actions.MoveToElement(headerOfEtsyCom.ClothingAndShoes).Perform(); webElementHelperes.WaitElement(driver, headerOfEtsyCom.ClothingAndShoesMens, 10); actions.MoveToElement(headerOfEtsyCom.ClothingAndShoesMens).Perform(); headerOfEtsyCom.ClothingAndShoesMensBoots.Click(); var discounts = driver.FindElements(By.XPath("//*[@class='text-body-smaller promotion-price normal no-wrap ']")); foreach (var discount in discounts) { string actualColour = discount.GetCssValue("color"); Assert.True(expectedColour == actualColour, $"Test failed, because {expectedColour} not equal {actualColour} for discounts elements"); } }