diff --git a/Rukavishnikova/src/test/java/ru/oriflame/pages/Search.java b/Rukavishnikova/src/test/java/ru/oriflame/pages/Search.java index 0c59976..08e00fd 100644 --- a/Rukavishnikova/src/test/java/ru/oriflame/pages/Search.java +++ b/Rukavishnikova/src/test/java/ru/oriflame/pages/Search.java @@ -3,14 +3,14 @@ package ru.oriflame.pages; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.PageFactory; + +import java.util.List; public class Search { public WebDriver driver; public Search(WebDriver driver) { - PageFactory.initElements(driver, this); this.driver = driver; } @@ -20,11 +20,25 @@ public class Search { @FindBy(css = "#form-search > fieldset > button") private WebElement searchButton; - public void inputSearchField(String keyWord) { - searchField.sendKeys(keyWord); + @FindBy(css = "#main > div.w-content.ui-search-content.mode-products-search") + private List listResultSearch; + + public void inputSearchField(String text) { + searchField.click(); + searchField.sendKeys(text); } public void clickSearchingButton() { 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; + } } \ No newline at end of file