42 lines
1.0 KiB
Java
42 lines
1.0 KiB
Java
package page;
|
|
|
|
import java.util.List;
|
|
|
|
import org.openqa.selenium.By;
|
|
import org.openqa.selenium.Keys;
|
|
import org.openqa.selenium.WebDriver;
|
|
import org.openqa.selenium.WebElement;
|
|
import org.openqa.selenium.support.FindBy;
|
|
import org.openqa.selenium.support.FindBys;
|
|
|
|
public class SearchPage {
|
|
WebDriver driver;
|
|
|
|
@FindBy(xpath = "/html/body/div[1]/header/div/div[2]/div/div/div/form/label/input[1]")
|
|
private WebElement inputField;
|
|
|
|
@FindBy(xpath = "//*[@id=\"js-pjax-container\"]/div/div[1]/div[1]/nav/a[7]/span")
|
|
private WebElement usersLink;
|
|
|
|
public SearchPage(WebDriver driver) {
|
|
this.driver = driver;
|
|
}
|
|
|
|
public SearchPage setSearchString(String text){
|
|
inputField.sendKeys(text);
|
|
return this;
|
|
}
|
|
|
|
public void clickSubmitButton() {
|
|
inputField.sendKeys(Keys.RETURN);
|
|
}
|
|
|
|
public void clickUsersLink() {
|
|
usersLink.click();
|
|
}
|
|
|
|
public boolean isUserPresent() {
|
|
return driver.findElement(By.cssSelector(".user-list-info")).isDisplayed();
|
|
}
|
|
}
|