Closed dadamschi closed 10 years ago
@Resource
's will only work in Springified classes. You need to make sure that Spring instantiates your services extending AbstractCappexPage
. You should be able to find many tutorials online on how to configure this.
I am trying to expand on the Demo for a proof of concept.
My ideal situation was to put a reference from to the ElementService in an abstract class and then use it in children classes. However, when instantiating the child class the ElementService I am trying to access is null.
My abstract class looks like this: public abstract class AbstractCappexPage extends BaseServiceHub { @Resource protected ElementService seleniumElementService;
}
My child class (a view) looks like this (abbreviated): public class CappexLoginPage extends AbstractCappexPage {
// private WebElement switchToSSL; // private WebElement switchFromSSL; @FindBy(how = How.CSS, using = "input[name=email]") private WebElement userEmailAddress; @FindBy(how = How.CSS, using = "input[name=password]") private WebElement userPassword; @FindBy(how = How.CSS, using = "button[type=submit]") private WebElement loginButton; @FindBy(how = How.CSS, using = "a.fbLogInBtn.fbLoginLink") private WebElement faceBookSignUpLink; @FindBy(how = How.LINK_TEXT, using = "Forgotten Password?") private WebElement forgotPasswordLink;
}
I have added a reference in the modules ReferenceDataPopulator (renamed): public class CappexReferenceDataPopulator implements ReferenceServicePopulator {
}
Am I making the correct assumption that I can do this?