Update MainPage.java

This commit is contained in:
Екатерина 2018-12-08 20:57:23 +00:00
parent 3b964d787e
commit 119520f2aa

View File

@ -1,21 +1,23 @@
package ru.oriflame.pages; package ru.oriflame.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
public class MainPage { public class MainPage {
public static WebDriver driver;
public WebDriver driver;
public MainPage(WebDriver driver) { public MainPage(WebDriver driver) {
PageFactory.initElements(driver, this); this.driver = driver;
} }
@FindBy(xpath = "//*[@id=\"primary-navigation\"]/ul/li[2]/a") @FindBy(xpath = "//*[@id=\"primary-navigation\"]/ul/li[2]/a")
private WebElement face; 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") @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; 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") @FindBy(css = "#hero-promo-slider > div.rsOverflow > div > div.rsSlide.rsActiveSlide > div > article > a > div.image-A1 > img")
private WebElement banner; 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; private WebElement product;
public void faceClick() { public void faceClick() { face.click(); }
face.click();
}
public void registrClick() { public void mainClick() { main.click(); }
registr.click();
} public void registrClick() { registr.click(); }
public void podvalClick() { public void podvalClick() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
podval.click(); podval.click();
} }
public void bannerClick() { banner.click(); } public void bannerClick() { banner.click(); }
public void productClick() { product.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(); }
} }