I am new to Selenium and Arquillian framework. I am trying to implement Page Object Model. Webdriver browser capabilities are saved in arquillian xml file.
I am using TestNG and created the following classes:
public class Test{
@Drone
Webdriver driver;
@Page
Login login;
@Page
Home home;
public void createOrderTest(){
login.navigateURL();
login.setcredentials();
home.createOrder();
}
}
public class Login{
// Webelements needed in methods below are declared here
public void navigateURL(){
driver.get("//url/login.aspx");
}
public void setCredentials(){
// code to enter username, password and click login
Graphene.waitAjax().until().element(signIn).is().not().visible();
}
}
public class Home{
// Webelements needed in methods below are declared here
public void createOrder(){
// code to create order
}
}
Problem Statement:
I am not sure how to navigate between Login
and Home
pages in code. Once user logs in using Login
page methods, how does Webdriver get to use Home
page methods to continue the test ?
Error:
Test runs fine with navigateURL
and setcredentials
methods. However, test fails to access createOrder
method as follows:
WARNING: Argument 1 for UpdateTestResultBeforeAfter.update is null. It won't be invoked.
FAILED CONFIGURATION: @BeforeMethod arquillianBeforeTest(public void Test.createOrder() throws javax.mail.MessagingException,java.io.IOException,java.security.GeneralSecurityException)
org.jboss.arquillian.graphene.enricher.exception.PageObjectInitializationException: Can not instantiate Page Object class Home
Please guide me. Thank you.