I have several questions regarding Page Object Model when used with Appium and TestNG.
What is the best place to ask?
You can ask here but make sure ask clearly so that we can help you out.
Currently I am working on the Page Object Model in Appium.
First question is about Returning Page Objects.
- IOS and Android application tested using Appium.
- We are attempting to use POM pattern.
- TestNG is used to run tests.
- @AndroidFindBy and @iOSXCUITFindBy locators are used
Test walks over several screens and then back.
Every screen has at least one POM object.
Screen A:
Button btn_b, opens B
Screen B:
Button btn_a, opens A
According to POM each click returns PageObject of page where Application is heading.
Test generally looks like:
A_PageObject a = new A_PageObject(); // Home screen.
B_PageObject b = a.click_b();
// Now I have two page objects a and b
// Option 1) for walking same screens again.
// Create new Objects and save them as new variables.
A_PageObject a1 = b.click_a();
A_PageObject b1 = a1.click_b();
// Option 2) for walking same screens again.
// Create new objects, but reuse old variables (discard old objects sooner)
a = b.click_a();
b = a.click_b();
// Option 3) for walking same screens again.
// Disregard new Objects. Use old objects.
b.click_a();
a.click_b();
Maybe strange question, but I am not sure what happens to WebElements in old Page Objects.
Currently leaning to option2…