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.
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.