Только начал изучать PageObject и не могу понять как передать значение @FindBy в другой метод
package Pages.TestPackage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class FindByClass {
@FindBy(how = How.XPATH,using = ".//*[@id='text']")
private WebElement search;
public FindByClass fieldSearch(){
return this;
}
}
package Pages.TestPackage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class FirstPage {
private WebDriver driver;
public FirstPage (WebDriver driver){
PageFactory.initElements(driver,this);
this.driver=driver;
}
public void waiter(String someXpathLocator){
WebDriverWait wait=new WebDriverWait(driver,10);
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(someXpathLocator)));
}
}
package Pages.TestPackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class TestClass {
private WebDriver driver;
@BeforeClass
public void open(){
driver=new FirefoxDriver();
driver.get("https://yandex.ua/");
driver.manage().window().maximize();
}
@Test
public void fieldSearch(){
FirstPage firstPage=new FirstPage(driver);
FindByClass findByClass =new FindByClass();
firstPage.waiter(findByClass.fieldSearch());
}
@AfterClass
public void close(){
driver.close();
}
}
Как можно в класс TestClass передать значение @FindBy с класса FindByClass