lundi 10 avril 2017

Unable to click on element passed from factory method

Hi i am trying to click on an element which location is defined using PageFactory.But it is showing NullPointerException.

Locator class:

@FindBy(xpath = "//*[@content-desc = 'Navigate up']")
public By backButton;

PageObject class:

public AskPage()
{
   PageFactory.initElements(driver, this);
}

public void backButtonClick()
{
   if(backButtondisplayed())
      commonactions.clickElement(driver, askLocator.backButton);
}

Am i doing anything wrong?

Note: I have not added classes. I have just added click method and locator for backbutton in page factory class.

Aucun commentaire:

Enregistrer un commentaire