I am automating a website using POM framework and I have one page class and a test class (out of many).
The page class is : FindPeople.java and the code I have written inside is like below:
public class FindPeople {
    @FindBy(id="ContentPlaceHolderDefault_Body_Body_Content_***SearchSimpleDialog_13_tbQuery")
    WebElement serachfield;
    @FindBy(xpath=".//*[@id='ContentPlaceHolderDefault_Body_Body_Content_***SearchSimpleResults_14_pnlResults']/div[1]/div/a")
    WebElement serachresult;
    public void typeInSearchField()
    {
        serachfield.sendKeys(DataProviderFactory.readHomeData().getPeopledata(2, 0));
    }
}
I have test class called VerifyInputField.java and code inside is like below:
public class VerifyInputField {
    WebDriver driver;
    @Test
    public void verifyInputField() throws AWTException {
        driver= BrowserFactory.getBrowser("Chrome");
        BrowserFactory.getURL();
        FindPeople findpeople = PageFactory.initElements(driver, FindPeople.class);
        findpeople.typeInSearchField();
     }
}
The problem is, the Webelemnts (serachfield, serachresult) I identified in FindPeople.java; are not accessible in VerifyInputField.java. I mean, I am not getting the usual methods like click(), gettext() using any of these elements.
Am I doing anything wrong?
 
     
     
     
    