Best practices for .pageObject files
A page object is the Java file which lists the field name and its locators for a single visulaforce or non-salesforce page.
Page Object Java file is located inside src/pageobjects folder and since It is a Java file it compiled file which is a class file is located bin/pageobjects folder.
Here are some common practices which we would suggest for the Page Objects.
- Do not put all your non-Salesforce or Visualforce mapped web elements in a single page object file. Use multiple page objects for different web pages.
- Not to add more than 500-600 lines of code in a single page object file as it is a Java file it needs to be compiled so, It would create performance issues
- Fix syntax error if it is present anywhere.
- Use Page Object Cleaner API to remove unwanted locators from page objects.
- Try to use the Provar page object editor tab instead of Java Source.
- Keep an eye on the Problems tab of Provar for any Page Object error, page object files always have a .java extension in the resource column. If you found one right-click on the problem and then click on the go-to resource button, so you jump on that page object directly.