fix selectors

This commit is contained in:
romanov73 2018-02-17 11:33:44 +04:00
parent d9b601b291
commit b35147f197
2 changed files with 5 additions and 12 deletions

View File

@ -1,15 +1,11 @@
import context.ChromeContext;
import context.Context;
import context.FirefoxContext;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
import page.SearchPage;
@ -22,7 +18,7 @@ public class GithubUserSearch {
public static void setup() {
context = new ChromeContext();
context.start();
context.getDriver().manage().window().setSize(new Dimension(1600,900));
context.getDriver().manage().window().setSize(new Dimension(1600, 900));
}
@AfterAll

View File

@ -1,28 +1,25 @@
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]")
@FindBy(css = "input.header-search-input")
private WebElement inputField;
@FindBy(xpath = "//*[@id=\"js-pjax-container\"]/div/div[1]/div[1]/nav/a[7]/span")
@FindBy(xpath = "//*[@class='menu border']/a[7]")
private WebElement usersLink;
public SearchPage(WebDriver driver) {
this.driver = driver;
}
public SearchPage setSearchString(String text){
public SearchPage setSearchString(String text) {
inputField.sendKeys(text);
return this;
}