Update FilterBy.java
This commit is contained in:
parent
8ab0bf1374
commit
3b964d787e
@ -1,16 +1,15 @@
|
||||
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 FilterBy {
|
||||
|
||||
public WebDriver driver;
|
||||
|
||||
public FilterBy(WebDriver driver) {
|
||||
PageFactory.initElements(driver, this);
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
@ -32,34 +31,137 @@ public class FilterBy {
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[6]/h3")
|
||||
private WebElement filterByBrand;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[3]/div/ul[1]/li[7]/a")
|
||||
private WebElement filterByAdvantageOsv;
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[5]/div/ul[1]/li[1]/a")
|
||||
private WebElement age12;
|
||||
|
||||
@FindBy(xpath = "//*[@id=\"main\"]/div[5]/div/section/div[1]/div/div/div[3]/form/ul/li[3]/div/ul[1]/li[1]/a")
|
||||
private WebElement anti;
|
||||
|
||||
public void faceClick() {
|
||||
face.click();
|
||||
}
|
||||
|
||||
public void FilterByAdvantageAnti() {
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
anti.click();
|
||||
}
|
||||
|
||||
public void filterByAge12() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
age12.click();
|
||||
}
|
||||
|
||||
public void openingFilterBy() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
openedFilterrBy.click();
|
||||
}
|
||||
|
||||
public void clickingFilterByIndications() {
|
||||
filetrByIndications.click();
|
||||
}
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
filetrByIndications.click(); }
|
||||
|
||||
public void clickingFilterByAge() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
filterByAge.click();
|
||||
}
|
||||
|
||||
public void clickingFilterByAdvantage () {
|
||||
try {
|
||||
Thread.sleep(15000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
filterByAdvantage.click();
|
||||
}
|
||||
|
||||
public void clickingFilterByBrand() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
filterByBrand.click();
|
||||
}
|
||||
|
||||
public void clickingFilterByAdvantageOsv () {
|
||||
filterByAdvantageOsv.click();
|
||||
public boolean AssertFilterBy() {
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean AssertByIndications() {
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form > ul > li.facet.row.g-all.opened > div > ul:nth-child(1)")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean assertFilterByBrand() {
|
||||
return driver.findElement(By.cssSelector("li.facet:nth-child(6) > div:nth-child(2) > ul:nth-child(1)")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean assertFilterByAdvantage() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filter-box.w-filter-box-no-css.fixed > form > ul > li.facet.row.g-all.opened > div > ul:nth-child(1)")).isDisplayed();
|
||||
}
|
||||
|
||||
public boolean assertFilterByAge() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filtering-info.g-all > div.w-filtered-facets > span")).getText().indexOf("12+") >= 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean assertFilterByAdvantageAnti() {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
return driver.findElement(By.cssSelector("#main > div:nth-child(5) > div > section > div.w-filter-bar > div > div > div.w-filtering-info.g-all > div.w-filtered-facets > span")).getText().indexOf("Антивозрастной Уход") >= 0;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user