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.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<WebElement> 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;
}
}