From b35147f197e0381a2551bd6151820f6d7df8891d Mon Sep 17 00:00:00 2001 From: romanov73 Date: Sat, 17 Feb 2018 11:33:44 +0400 Subject: [PATCH] fix selectors --- src/test/java/GithubUserSearch.java | 6 +----- src/test/java/page/SearchPage.java | 11 ++++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/test/java/GithubUserSearch.java b/src/test/java/GithubUserSearch.java index 1d31169..68e7ddd 100644 --- a/src/test/java/GithubUserSearch.java +++ b/src/test/java/GithubUserSearch.java @@ -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 diff --git a/src/test/java/page/SearchPage.java b/src/test/java/page/SearchPage.java index d358cfe..87f5b38 100644 --- a/src/test/java/page/SearchPage.java +++ b/src/test/java/page/SearchPage.java @@ -1,32 +1,29 @@ 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; } - + public void clickSubmitButton() { inputField.sendKeys(Keys.RETURN); }