Update SortBy.java

This commit is contained in:
Екатерина 2018-12-08 20:58:31 +00:00
parent 307e02ad68
commit 4d3f85fab9

View File

@ -1,15 +1,15 @@
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 SortBy { public class SortBy {
public WebDriver driver; public WebDriver driver;
public SortBy(WebDriver driver) { public SortBy(WebDriver driver) {
PageFactory.initElements(driver, this);
this.driver = driver; this.driver = driver;
} }
@ -27,10 +27,39 @@ public class SortBy {
} }
public void sortByClick() { public void sortByClick() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
sortingBy.click(); sortingBy.click();
} }
public void sortByPopularClick() { public void sortByPopularClick() {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
byPopular.click(); byPopular.click();
} }
public boolean assertShowMenuSort() {
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-sort-box.fixed > ul")).isDisplayed();
}
public boolean assertcheckLinkBySort() {
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-filtering-info.g-all > div.w-filtered-facets > span")).getText().indexOf("популярности") >= 0;
}
} }