From 119520f2aa2b4be612ad72ed75d16a007ec13c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BA=D0=B0=D1=82=D0=B5=D1=80=D0=B8=D0=BD=D0=B0?= Date: Sat, 8 Dec 2018 20:57:23 +0000 Subject: [PATCH] Update MainPage.java --- .../test/java/ru/oriflame/pages/MainPage.java | 42 ++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java index 7c636f0..790f93d 100644 --- a/Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/MainPage.java @@ -1,21 +1,23 @@ package ru.oriflame.pages; +import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; public class MainPage { - - public WebDriver driver; + public static WebDriver driver; public MainPage(WebDriver driver) { - PageFactory.initElements(driver, this); + this.driver = driver; } @FindBy(xpath = "//*[@id=\"primary-navigation\"]/ul/li[2]/a") private WebElement face; + @FindBy(css = "body > header > div > div.ui-header-bar > nav > div > div.ui-logo > a > span > svg") + private WebElement main; + @FindBy(css = "body > header > div > div.ui-sticky-bar.js-sticky-bar > div.w-sticky-bar-list.clearfix > ul > li:nth-child(3) > a") private WebElement registr; @@ -25,22 +27,40 @@ public class MainPage { @FindBy(css = "#hero-promo-slider > div.rsOverflow > div > div.rsSlide.rsActiveSlide > div > article > a > div.image-A1 > img") private WebElement banner; - @FindBy(css = "#main > div > div:nth-child(2) > div > div > div > section.tab.ui-product-list.g-all.active > a:nth-child(1) > div.figure > img") + @FindBy(css = "#main > div:nth-child(5) > div > section > section > a:nth-child(1) > div.figure > img") private WebElement product; - public void faceClick() { - face.click(); - } + public void faceClick() { face.click(); } - public void registrClick() { - registr.click(); - } + public void mainClick() { main.click(); } + + public void registrClick() { registr.click(); } public void podvalClick() { + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } podval.click(); } public void bannerClick() { banner.click(); } public void productClick() { product.click(); } + + public static boolean assertHeightMenu() { return driver.findElement(By.cssSelector("#main > div.w-top-area-banner.category-skincare.with-background.with-img > div.ui-banner-image > img")).isDisplayed(); } + + public static boolean assertBanner() { return driver.findElement(By.cssSelector("#facets-search-results > section")).isDisplayed(); } + + public static boolean assertProduct() { return driver.findElement(By.cssSelector("#pdp-image-slider > div.rsOverflow > div > div:nth-child(1) > div > img")).isDisplayed(); } + + public static boolean assertRegister() { return driver.findElement(By.cssSelector("#main > div.w-content > div > div > p")).isDisplayed(); } + + public static boolean assertDown() { + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + }return driver.findElement(By.cssSelector("#main > div > div > div")).isDisplayed(); } }