From 307e02ad689576e342b88ca0fb0cafd72bd723a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BA=D0=B0=D1=82=D0=B5=D1=80=D0=B8=D0=BD=D0=B0?= Date: Sat, 8 Dec 2018 20:57:58 +0000 Subject: [PATCH] Update Search.java --- .../test/java/ru/oriflame/pages/Search.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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