Page Object Pattern

Pattern based design is not only efficient, but also extremely helpful in organizing, and scaling tests. The most common test pattern is Page Object pattern. It includes an abstraction layer, and the subsequent sub-classes that divide the test framework in organized pattern with each Page encapsulating the methods, and locators relating to the Page. The biggest advantage of the Page Object pattern is that it hides the implementation details from the test, so that the test are easier to read.

It is not a good idea to expose webdriver APIs in the test methods. Exposing such creates room for messy code structure. Wrapping all the webdriver APIs in  Page Objects makes your code more readable when you need to refactor the codes.