I looked over here where the Selenium author recommended to not use anymore Page Object Factory but to use SOLID instead. What are the reasons to use these and what is recommended to use in terms of Automation in Java? Also, I didn't find any easy good example of the 5 principles of the SOLID so I can compare it to my code, I will be glad to see something like.

  • The title asks POM vs POF and but the question contents writes about SOLID. – Niels van Reijmersdal Apr 2 '19 at 7:58
  • There's a difference between not using Page Factory and not using Page Object Model. :) – FDM Apr 2 '19 at 8:28
  • there is something that the implementation of the POF is not really good in front of POM, what is that reason? – john Apr 2 '19 at 9:02

SOLID and Page Object Factory are not mutually exclude. However, I would argue that understanding the first is way more important than applying the latter, in order to write readable and extendable code.

This article explains each principles and Bob Martin himself dives deep into the Single Responsibility Principle here, which is, IMO, the most important of the 5 to avoid unmaintainable code and the easiest to use to guide refactoring of any codebase:

  • Do you have a function called "blablablaAndblablabla"? You are breaking SRP.
  • Do you have a class where half of the functions called half attributes? You are breaking SRP.
  • Do you need more than one assert to validate the consequencies of a function? You are breaking SRP.
  • Do you have the same assert across multiple tests? You are breaking SRP.
  • 1
    and about the "not using the POF", why is that? what is the difference in the instantiate? – john Apr 1 '19 at 18:11

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.