Update Search.java

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

View File

@ -3,14 +3,14 @@ package ru.oriflame.pages;
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;
import java.util.List;
public class Search { public class Search {
public WebDriver driver; public WebDriver driver;
public Search(WebDriver driver) { public Search(WebDriver driver) {
PageFactory.initElements(driver, this);
this.driver = driver; this.driver = driver;
} }
@ -20,11 +20,25 @@ public class Search {
@FindBy(css = "#form-search > fieldset > button") @FindBy(css = "#form-search > fieldset > button")
private WebElement searchButton; private WebElement searchButton;
public void inputSearchField(String keyWord) { @FindBy(css = "#main > div.w-content.ui-search-content.mode-products-search")
searchField.sendKeys(keyWord); private List<WebElement> listResultSearch;
public void inputSearchField(String text) {
searchField.click();
searchField.sendKeys(text);
} }
public void clickSearchingButton() { public void clickSearchingButton() {
searchButton.click(); searchButton.click();
} }
public boolean checkSearch(String strSearch) {
boolean checkSearch = false;
int count = listResultSearch.size();
for (int i = 0; i < count - 1; i++) {
if (listResultSearch.get(i).getText().contains(strSearch))
checkSearch = true;
}
return true;
}
} }