3

When developing multi-platform test framework (e.g. mobile-focused) there can be several ways to use PageObject pattern. For instance, platforms can be separated at least:

  • at the level of locators & methods (i.e. 1 element will have several locators)
  • at the level of whole pages/screens (i.e. 1 abstract page will have several implementation)
  • ... (your suggestion may be here)


How do you think: What's the advantages of each one? Is there the best one to use?

  • 1
    You can create class for page and page-locator. For example Login page locator will have separate class and login page method will be in separate class. so it will something like data and element will have diff. class. – Helping Hands Jun 12 '15 at 11:06
  • 1
    When you say "multi-platform", do you mean web browsers on different mobile devices, or different native apps? – user246 Aug 16 '15 at 14:31
1

I am not expert on responsive design for mobile devices, but AFAIK most differences should be different CSS styling for the same HTML, using same locators for all page formats.

But you have a valid point that some CSS might i.e. hide navigation for small screen into button (requiring extra click to expand it if present).

Approach which I would consider (we are not there yet, but getting closer): Each pageobject has method to perform activities, which would behave the same for the pageobject user (hiding the differences between platforms). If activity needs special handling, in ideal world this should be detected by presence of extra button on some platforms, and click it if needed to implement the behavior.

Let's see opinion of experts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.