- In the locator files, the keys of the locator values should follow a common syntax so it will be easy to understand what the locator is meant for.
- There should be no duplicates of any locator keys in platform-specific locator files.
- All the selenium code should be written in the Page classes only.
- The step definitions should only have the calls to the Page Class methods.
- Operations on the screen should be kept in separate methods then the validations.
- In the feature or BDD files, the operations on the screens should be stated as When statements and the validations should be kept as then statements.
- Use of static waits should be avoided and . Try to kept to minimalit minimal and rely more on Wait services.
- If you are performing any clicks on the elements then one can avoid the verification of the same elements as the click command will validate that the element was there on the screen.
- Use of static keyword should be strictly avoided to store webelements/webdriver in variables as it will cause issues in parallel execution. This is because the static class variables will be shared across the threads in Java.