we do it in another way.
Base Page:
public abstract class Page {
protected WebDriver driver;
public Page(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(new AppiumFieldDecorator(driver, 30, TimeUnit.SECONDS), this);
}
}
Page example:
public class CallPage extends Page {
//Action bar
@AndroidFindBy(id = "homeButton")
private List<AndroidElement> homeButton;
@AndroidFindBy(id = "backButton")
private List<AndroidElement> backButton;
// and other elements here .....
public CallPage(WebDriver driver) {
super(driver);
}
public boolean isCallPageLoaded() {
return !homeButton.isEmpty() && !backButton.isEmpty();
}
}
Base Test:
public class BaseTest {
protected static AppiumDriver driver = null;
// testNG staff here...
}
Test:
public class test_Call extends BaseTest {
private CallPage callPage;
callPage = new CallPage(driver);
assertTrue("Call page is NOT loaded", callPage.isCallPageLoaded());
}